AD
Administrator
Syncfusion Team
June 8, 2006 05:37 AM UTC
Hi Christian,
You need to check the current cell for detecting the cell button visbility of the cell with GridShowButtons.ShowCurrentCell option in a grid. Here is a code snippet.
///
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
{
TraceUtil.TraceCurrentMethodInfo(rowIndex, colIndex, style, innerBounds, buttonsBounds);
// Here you specify where the button should be drawn within the cell.
Rectangle rightArea = Rectangle.FromLTRB(innerBounds.Right-20, innerBounds.Top, innerBounds.Right, innerBounds.Bottom);
buttonsBounds[0] = GridUtil.CenterInRect(rightArea, new Size(20, 20));
// Here you return the area where the text should be drawn/edited.
//To Check the button shown or not shown.
if( style.ShowButtons == GridShowButtons.ShowCurrentCell || style.ShowButtons == GridShowButtons.ShowCurrentCellEditing )
{
// For ShowCurrentCell option button show after click the cell.
if( rowIndex == this.CurrentCell.RowIndex && colIndex == this.CurrentCell.ColIndex)
{
innerBounds.Width -= 20; //For button shown
}
}
else if ( style.ShowButtons == GridShowButtons.Hide )
innerBounds.Width -= 0;
else
innerBounds.Width -= 20;
return innerBounds;
}
Let me know if this helps.
Regards,
Haneef
CL
Christian Lützenkirchen
June 8, 2006 08:21 AM UTC
Hi Haneef,
your sample works fine. Thank you very much for your help!
Regards,
Christian