Piotr Pikielny
2018-04-03T13:19:48Z
Hello,

How to write a method that draws a line between two Points of a given grid where Graphics object, Pen object and these two Points are inputs to that method?
In other words, how to get the proper Graphics object while not using grid_CustomDrawCellForeground event?

Thanks in advance for your help.
Igor/10Tec
2018-04-04T07:52:10Z
IF you need to implement custom drawing in iGrid cell, you must acquire the corresponding Graphics object to draw on only from an event related to custom drawing - such as CustomDrawCellForeground or PostPaint. Actually that Graphic object is inherited or passed from the control's Paint event, and this is the only right Graphics object related to the control you can draw on.
Piotr Pikielny
2018-04-04T10:51:58Z
Thank you for quick response.

For any given cell of a grid, iGrid's user can invoke action to set cell's value, backcolor, forecoler etc.
I'd like to be able to invoke action to draw any of four (top, bottom, left, right) elements of border of a given cell.
Using grid_Paint allows to draw any lines you want but in a static, predefined way.
I need to do it in a dynamic way while processing specific cells of consecutive rows.
How to do it?


Igor/10Tec
2018-04-04T13:47:02Z
Use the CustomDrawCellBackground event for that. Set the CustomDrawFlags property for required cells to iGCustomDrawFlags.Background to generate this event for them, and draw your own borders in the event handler.

Apparently, you will need to store a value indicating which borders are enabled in every cell. You can define your own class or structure for that, and store its instances in the AuxValue property of every cell. It's like the well-known Tag property. Note that it is used by iGrid only in the case of combo box cells, but I think this is not your case.
Users browsing this topic