Event Double Click between two header

Nov 4, 2010 at 3:14 PM
Edited Nov 4, 2010 at 3:15 PM

Hello ,

I am using sourcegrid  as usual  , a good option appeared for  me under this greategull grid ,

the event doubleclick on the seperator between two header do a function of autosize for a best show  , i tried this function under excell , work well , under the explorer workwell :))

my question is how to reproduce this event by code  ? it can be better the the exist one  autosizecell ( better performance  and  better result )

i tested  this event under windows seven 64 bit but i think it work also under  xp and other version

I uploaded the demo if my explication is poor

.gif demo low  quality : http://www.multiupload.com/96RDFFEB4Z

.avi demo hight quality : http://www.multiupload.com/MIJ9T54IZG

i hope some one know the answer  , may be a hook from windows  , may be not .

 

 

Nov 4, 2010 at 5:22 PM

I thing i getted  , sorry for disturb

 

just to share the source from the code

 

at SourceGrid.Cells.Controllers.Resizable

On event OnDoubleClick

 

public override void OnDoubleClick(CellContext sender, EventArgs e)
{
base.OnDoubleClick(sender, e);

Point currentPoint = sender.Grid.PointToClient(System.Windows.Forms.Control.MousePosition);
Rectangle cellRect = sender.Grid.PositionToRectangle(sender.Position);

float distance;
DevAge.Drawing.RectanglePartType partType = LogicalBorder.GetPointPartType(cellRect, currentPoint, out distance);

if ((ResizeMode & CellResizeMode.Width) == CellResizeMode.Width &&
partType == DevAge.Drawing.RectanglePartType.RightBorder)
{
sender.Grid.Columns.AutoSizeColumn(sender.Position.Column);
}
else if ((ResizeMode & CellResizeMode.Height) == CellResizeMode.Height &&
partType == DevAge.Drawing.RectanglePartType.BottomBorder)
{
sender.Grid.Rows.AutoSizeRow(sender.Position.Row);
}
}