Home Forums WinForms controls Xceed Grid for WinForms Programmers without Borders Reply To: Programmers without Borders

Xceed Support
Post count: 5658

I know this is a old thread, but I have found it useful and can shed some light on how to make a double line. 

I have used an extended DataRow only, rather than an extended DataCell in conjunction with an extended DataRow.  This is because I have been drawing horizontal borders at the top and bottom of some whole rows rather than left and right vertical borders on individual cells.  But I expect the same principal applies.

I have found that overriding PaintBorders imposes two restrictions on the kind of lines that can be drawn.  First, as Soong has mentioned, it is only possible to draw lines exactly on the borders.  So double lines, i.e. with the second line just inside the cell relative to the line on the border.  Secondly the width of the line is always one pixel, irrespective of the Width of the Pen with which the line is drawn.

The circumvention is to override PaintForeground instead of PaintBorders.  I should think overriding PaintBackground would work too, but I have not tried that.  By overriding PaintForeground, I can draw a nice thick line on the row border.  (I find that a single-pixel black line does not stand out enough compared with the standard grid lines.)  And I can draw a second line just inside the cell.  Presumably it would be possible to have stripes going all the way down or across!

Imported from legacy forums. Posted by Simon (had 1592 views)