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
close icon

Gridlines in DataGrid

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

2 Replies

II Iulian Ionescu 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?


II Iulian Ionescu December 28, 2002 12:04 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon