Forum > Databases

DBGrid - DrawColumnCell Event - Pen.width

(1/1)

Nicole:
I have a DBGrid which I migrate from Delphi
In the DrawColumnCell Event there are a lot of Graphic items, which works fine.

The one below does not. It shall draw think lines between the rows, if certain conditions are true.
Here is the snippet of the code within the event:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---             Canvas.Pen.Color := $00243C79;       Canvas.Pen.Width := 5;       Canvas.MoveTo(Rect.Left,Rect.Top);       Canvas.LineTo(Rect.Right,Rect.Top); // draws a red line to the rect's  upper frame
Has anybody any hint, why I cannot see my effect?

korba812:
Maybe Pen.Style is set to psClear? Try to set Pen.Style := psSolid.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---             Canvas.Pen.Color := $00243C79;       Canvas.Pen.Width := 5;       Canvas.Pen.Style := psSolid;  // <---       Canvas.MoveTo(Rect.Left,Rect.Top);       Canvas.LineTo(Rect.Right,Rect.Top); // draws a red line to the rect's  upper frame

Nicole:
Thank you for the idea.
I tried, unfortunately not.

wp:
It is working for me -- see attachment. But not very well... This is because the grid is drawn after the cells, and because clipping is active which cuts off everything reaching out of a cell (when you draw a thick line from cell.Left to cell.Right at cell.Top half of the line width goes into the neighbour cell). In FPSpreadsheet (TsWorksheetgrid) I had to override DrawAllRows and paint the specials like cell borders at the very end of the painting cycle.

Nicole:
Thank you so much for the hints and for the critical view.

Perhaps I will leave the thick lines alone. In Delphi they worked fine, but I am not "married with them" (can we say this in English?)

I can colour the cell backgrounds alternating instead of drawing lines.

btw:
The lines did not work "that" fine in Delphi, - but only up to cell number - - 13. Oh yes, I have 25 fields and the lines were only for a part of them, because Delphi (XE3) refuses to count higher. I tried hard in former times to have a different solution. I hardly forgot this, - and - yeah!! - I will forget it now. As so many things, I may forget about my old Delphi and Embarcadero and licence-checks-online-only every new installation....

PS: The yellow colour really looks nicely, maybe I use this effect one day. I'll keep it, thank you for the project.

Navigation

[0] Message Index

Go to full version