custom lines in grid cell

I am using syncfusion 5.2 grid control. In one of the columns i need to add lines of different style for example in
col[5]...row[1] there could be a dashedline in blue color
col[5]...row[2] there could be a dashedline in red color
col[5]...row[3] there could be a solid in red color
Is this possible in syncfusion grid.
I will be very thankful if anyone could help me with this.
Please find the attached image with this query.



Lines_8b1dc169.zip

1 Reply

JJ Jisha Joy Syncfusion Team July 22, 2008 12:03 PM UTC

Hi Prabhjeet,

Thank you for your interest in Syncfusion Product.

You have to handle CellDrawn event and you can draw the required lines. Please refer the codes:



this.gridControl1.CellDrawn += new Syncfusion.Windows.Forms.Grid.GridDrawCellEventHandler(gridControl1_CellDrawn);

void gridControl1_CellDrawn(object sender, Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs e)
{
GridControl grid = sender as GridControl;


if(e.RowIndex ==2 && e.ColIndex==2)

{

Pen myPen = new Pen(Color.Pink);
myPen.Width = 2f;
myPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
e.Graphics.DrawLine(myPen, new Point(e.Bounds.Left , e.Bounds.Top + 7), new Point(e.Bounds.Right, e.Bounds.Bottom -7 ));
e.Cancel = true;

}
}



Please try this and let me know if this helps.

Regards,
Jisha


Loader.
Up arrow icon