We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drawing of GridLines

In the onPaint event (or possibly override), I want to re-draw the gridlines for a specific cell. (top,bottom,left & right). What method should I call to redraw these lines? Thanks, Steve

1 Reply

AD Administrator Syncfusion Team November 30, 2004 08:00 AM UTC

You can try this static method. GridBorderPaint.DrawRectangle Here is code that the grid uses to draw borders.
public void OnDrawBorders(Graphics g, Rectangle rectItem, GridStyleInfo style)
	// Draw Borders
	Color backColor = m_grid.GetBackColor(style.Interior.BackColor);
	GridBordersInfo borders = style.ReadOnlyBorders;
	TraceUtil.TraceCurrentMethodInfoIf(Switches.GridBorderPaint.TraceVerbose, m_grid.PaneDesc, rectItem, borders);
	GridBorderPaint.DrawRectangle(g, borders.Top, rectItem, backColor, GridBorderSide.Top, m_grid.PrintingMode);
	GridBorderPaint.DrawRectangle(g, borders.Bottom, rectItem, backColor, GridBorderSide.Bottom, m_grid.PrintingMode);
	if (this.isRightToLeft())
		GridBorderPaint.DrawRectangle(g, borders.Right, rectItem, backColor, GridBorderSide.Left, m_grid.PrintingMode);
		GridBorderPaint.DrawRectangle(g, borders.Left, rectItem, backColor, GridBorderSide.Right, m_grid.PrintingMode);
		GridBorderPaint.DrawRectangle(g, borders.Left, rectItem, backColor, GridBorderSide.Left, m_grid.PrintingMode);
		GridBorderPaint.DrawRectangle(g, borders.Right, rectItem, backColor, GridBorderSide.Right, m_grid.PrintingMode);

Live Chat Icon For mobile
Up arrow icon