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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Drawing of GridLines

Thread ID:





21950 Nov 29,2004 11:27 PM UTC Nov 30,2004 08:00 AM UTC WinForms 1
Tags: GridControl
Asked On November 29, 2004 11:27 PM UTC

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

Administrator [Syncfusion]
Replied On 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);


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon