StephleHardi
2022-10-14T06:26:19Z
Hello Igor
First of all, in these difficult times, I wish you to see happier days soon.

Well, I'm going to show you a problem that I can't solve.

I want to draw a horizontal line to separate 2 parts of the grid
I use the following method:
Private Sub G1_CustomDrawCellBackground(sender As Object, e As iGCustomDrawCellEventArgs) Handles G1.CustomDrawCellBackground
dim BCB = New SolidBrush(Color.Red)
e.Graphics.FillRectangle(BCB, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, 3)
End Sub

I call this method as follows:
For i as integer = 0 To grid1.Cols.Count - 1
Grid1.Cells(20, i).CustomDrawFlags = iGCustomDrawFlags.Background
Next

it works well but the color of the concerned cells (Backcolor) always takes the background color of the grid and the background color of the cells that I had defined before is lost

Is there a way to keep the predefined color ?

Thanks you and I think of you

Stephane

Igor/10Tec
2022-10-17T08:38:47Z
Email us a sample to reproduce your problem, please.
StephleHardi
2022-10-17T09:30:10Z
Hi Igor,

Each time a line is drawn with the method I described in my 1st posting, the cells under the lines lose the defined color and take on the background color of the grid

see attached Jpg please
Thank

Stephane

Cap_17_10_2022.JPG

Click to View Image8 View(s)

Igor/10Tec
2022-10-17T13:55:34Z
It's hard to figure out why you have this problem just looking at the screenshot. it may be because of merged cells or some specific non-default iGrid property values. That's why I need a sample demonstrating this issue. It will be easy to create one, as I can judge by your screenshot. Don't forget to include all property assignments from your real-world project.
StephleHardi
2022-10-17T14:58:59Z
To make an example, in my program, I add a window, I put a grid without any configuration
(Just 2 columns)

Then in this window, the only code I write is the one you will find attached

...And the cells under the red lines take on the background color of the grid

Thank

Cap_2.JPG

Click to View Image5 View(s)

Cap_Code.JPG

Click to View Image7 View(s)

Thank
Igor/10Tec
2022-10-18T13:40:25Z
If it's so easy to implement, do it and send this project to us. It's still not entirely clear to me how you set up your grid...
StephleHardi
2022-10-18T15:43:51Z
Here is a simple example.

The grid is not configured. it is just placed on the window with 2 columns

(But in other circumstances, Even configured, it's the same)

Thank

Stephane

  Test_Igrid.zip (449kb) downloaded 4 time(s).
Igor/10Tec
2022-10-19T13:57:56Z
Thank you for the project!

iGrid works correctly. You redefined the drawing of the background of the cells in the 3rd and 9th rows:

Private Sub igrid1_CustomDrawCellBackground(sender As Object, e As iGCustomDrawCellEventArgs) Handles IGrid1.CustomDrawCellBackground

    e.Graphics.FillRectangle(BCB, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, 3)
    '  The cells located just below the created line take the background color of the grid
    '  even if another color has been defined for these cells

End Sub

You completely replaced the standard background with your own one. And if so, iGrid does not fill the background with the cell background color. That's why these cells look as transparent so that you can see the grid background.

To solve your problem, you need one more FillRectangle call that fills the whole cell background with the cell backcolor.
StephleHardi
2022-10-19T15:41:51Z
As usual, fast and efficient, thank you Igor
Stephane