Highlight whole grid border

Hi,

I would like to highlight (say by a particular color) the grid border of a databoundgrid upon selection of a particular cell or cliclking on the cell.

Any property or way to acheive this?

Thanks,
Dheeraj

4 Replies

AD Administrator Syncfusion Team November 22, 2006 10:28 AM UTC

Hi Dheeraj,

Please refer to the below forum thread for changing the selected row border in a grid.
http://www.syncfusion.com/support/forums/message.aspx?MessageID=44233

If you want to change the border color of the grid, you can use the Paint event and draw border using DrawRectangle method. Here is a code snippet to show this.

private void gridControl1_Paint(object sender, PaintEventArgs e)
{
GridControl grid = sender as GridControl;
Rectangle rect = new Rectangle(new Point(0,0),grid.Bounds.Size);
rect.Inflate(-1,-1);
Pen pen = new Pen(Brushes.RoyalBlue,2);
e.Graphics.DrawRectangle(pen,rect);
}

Best Regards,
Haneef


DH Dheeraj November 22, 2006 10:44 AM UTC

Hi Haneef,

Thanks for the Paint event code, only thing is I need to paint the border only when clilking on the grid control. How do I call this event method from the Clik event?

Thanks,
Dheeraj


AD Administrator Syncfusion Team November 22, 2006 11:41 AM UTC

Hi Dheeraj,

Use this code to refresh the grid.

this.gridControl1.Invalidate();

Best Regards,
Haneef


DH Dheeraj November 23, 2006 06:03 AM UTC

That worked...Thank you!

Loader.
Up arrow icon