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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Gridlines in DataGrid

Thread ID:





2276 Dec 27,2002 11:27 PM UTC Dec 28,2002 12:04 PM UTC WinForms 2
Tags: FAQ
Iulian Ionescu
Asked On December 27, 2002 11:27 PM UTC

Ok, my problem is with drawing custom borders around cells in a datagrid. Everything works out fine (deriving columns, overriding paint, etc...), all works ok with the left and right borders (no matter how wide the pen is). But the problem appears with the bottom and top borders. The problem is that if I try to display the bottom border at the bottom of the bounds rect and the top border at the top of the bounds, there is a pixel line space between them. I had two options: 1) move the bottom border one pixel lower, but in that case the line doesn't display at all (like if there is an additional paint event that erases it); 2) to move the top line one pixel higher, but in this case whenever you move the cursor towards down the top cells do not refresh and the top line "sticks" there. For example if the regular borders are red and the border for the currently selected cell is blue, when you move the cursor down the top blue line remains there (until you select something higher that makes it refresh)... The closest to a correct result that I got was only when I use the same type (size and color) of borders for the current selection and as for the normal cells. Any help would be appreciated, Thank you, Iulian

Iulian Ionescu
Replied On December 28, 2002 12:02 PM UTC

Ok, I spent a lot of time last nite on this. I realized that no matter what, whenever you change the focus from one cell to any other the only refresh occurs for the row where the new selected cell is and all the rows under it, but NOT for any row above. So, probably my correct question would be: how do I force the datagrid to invalidate it's entire view?

Iulian Ionescu
Replied On December 28, 2002 12:04 PM UTC

Ok, I solved it... I just needed to put a me.refresh in the OnCurrentCellChanged... phew! :-)


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