Hi Haneef,
In your example, Table2_DrawCell is checking e.ColIndex == 3, which is actually the expand collapse icon. Why is it that the first real column is actually at index 4?
Thanks
John
>Hi John,
You can use the DrawCell event of GridTableControl to achieve this.
grid.GetTableControl("NavParent").DrawCell += new GridDrawCellEventHandler(NavParent_DrawCell);
grid.GetTableControl("Table2").DrawCell += new GridDrawCellEventHandler(Table2_DrawCell);
void Table2_DrawCell(object sender, GridDrawCellEventArgs e)
{
if (e.ColIndex == 3)
{
e.Renderer.Draw(e.Graphics, e.Bounds, e.RowIndex, e.ColIndex, e.Style);
Icon failureIcon = SystemIcons.Error;
Icon warningIcon = SystemIcons.Warning;
Rectangle iRect = new Rectangle(e.Bounds.Width - 100, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.DrawIconUnstretched(warningIcon, iRect);
iRect.X = iRect.X + 80;
e.Graphics.DrawIconUnstretched(failureIcon, iRect);
e.Cancel = true;
}
}
void NavParent_DrawCell(object sender, GridDrawCellEventArgs e)
{
if (e.ColIndex == 3)
{
e.Renderer.Draw(e.Graphics, e.Bounds, e.RowIndex, e.ColIndex, e.Style);
Icon failureIcon = SystemIcons.Error;
Icon warningIcon = SystemIcons.Warning;
Rectangle iRect = new Rectangle(e.Bounds.Width - 100, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
e.Graphics.DrawIconUnstretched(warningIcon, iRect);
iRect.X = iRect.X + 80;
e.Graphics.DrawIconUnstretched(failureIcon, iRect);
e.Cancel = true;
}
}
Please refer to the attached sample for modification.
GGCModified.zipBest Regards,
Haneef