DataGridColumnStyle paint override fails on last cell in row

  • Thread starter Thread starter Mark.Larsen
  • Start date Start date
M

Mark.Larsen

I made a class that extends DataGridColumnStyle. In the
Paint override I draw a border around each cell in the
column.

All cells look fine except for the last one (final row).
The lines I draw in the far right and bottom of the cell
don't show. I can draw 1 pixel up from the bottom and 1
pixel left of the right border. What is preventing me
from painting the border around this last cell?
 
Hello Mark,

I'm afraid custom-drawn cells are not supposed to draw borders around
themselves. The grid has a feature called "GridLines" which will draw a
border around every cell in the grid.

Then, there's a "gotcha" with coordinates passed to DrawRect (or however it
is called in .NET) routines, related to just right-bottom corner. I'd
suggest reviewing MSDN docs to ensure how EXACTLY the passed coordinates are
interpreted by this routine.
 
Who draws the grid lines? DataGrid? I need to override
whomever paints the lines so I can tailor the cell
borders.
-----Original Message-----
Hello Mark,

I'm afraid custom-drawn cells are not supposed to draw borders around
themselves. The grid has a feature called "GridLines" which will draw a
border around every cell in the grid.

Then, there's a "gotcha" with coordinates passed to DrawRect (or however it
is called in .NET) routines, related to just right- bottom corner. I'd
suggest reviewing MSDN docs to ensure how EXACTLY the passed coordinates are
interpreted by this routine.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"(e-mail address removed)"
 
It's most likely the grid itself that draws the cell borders. However, you
cannot override this particular drawing step - you can only override the
whole grid painting routine.
 
Back
Top