AD
Administrator
Syncfusion Team
August 26, 2005 01:11 PM UTC
I found solution:
In case if someone will need it too: in my ExpandButton that derives from GridDataBoundRowExpandCellButton
next methods were overrided:
public override int HitTest(int rowIndex, int colIndex, MouseEventArgs e, IMouseController controller)
{
GridStyleInfo style = this.Grid.GetViewStyleInfo(rowIndex, colIndex, true);
GridCellLayout layout = this.Owner.GetCellLayout(rowIndex, colIndex, style);
int tag = 0;
if(style.Tag != null)
tag = (int)style.Tag;
int offset = 10*tag;
Rectangle withButton = Rectangle.FromLTRB(layout.CellRectangle.Left + offset, layout.CellRectangle.Top, layout.CellRectangle.Left + offset + 11, layout.CellRectangle.Bottom);
if(withButton.Contains(e.X,e.Y))
{
return GridHitTestContext.CellButtonElement;
}
return GridHitTestContext.None;
}
public override void MouseDown(MouseEventArgs e, GridCellHitTestInfo ht)
{
GridStyleInfo style = this.Grid.GetViewStyleInfo(ht.RowIndex, ht.ColIndex, true);
GridCellLayout layout = this.Owner.GetCellLayout(ht.RowIndex, ht.ColIndex, style);
int tag = 0;
if(style.Tag != null)
tag = (int)style.Tag;
int offset = 10*tag;
Rectangle buttonBounds = Rectangle.FromLTRB(layout.CellRectangle.Left + offset, layout.CellRectangle.Top, layout.CellRectangle.Left + offset + 11, layout.CellRectangle.Bottom);
ht.CellButtonBounds = buttonBounds;
base.MouseDown (e, ht);
}
public override void MouseUp(MouseEventArgs e, GridCellHitTestInfo ht)
{
GridStyleInfo style = this.Grid.GetViewStyleInfo(ht.RowIndex, ht.ColIndex, true);
GridCellLayout layout = this.Owner.GetCellLayout(ht.RowIndex, ht.ColIndex, style);
int tag = 0;
if(style.Tag != null)
tag = (int)style.Tag;
int offset = 10*tag;
Rectangle buttonBounds = Rectangle.FromLTRB(layout.CellRectangle.Left + offset, layout.CellRectangle.Top, layout.CellRectangle.Left + offset + 11, layout.CellRectangle.Bottom);
ht.CellButtonBounds = buttonBounds;
if (FireClickOnMouseUp && buttonBounds.Contains(new Point(e.X, e.Y)))
OnClicked(new GridCellEventArgs(ht.RowIndex, ht.ColIndex));
this.SetMouseDown(ht, false);
}
Now it''s works - buttons have differet offset and they are working
Thanks anyway