Difference between Linux and Windows canvas resp. GradientFill? lazarus / 39-Graphics ---------------------------------------------------------------------- Fish · 2020-05-12 15:55 Hi, I wrote my own procedure to add, among other things, a gradient to whatever components which very simplified looks like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure PaintGradient(ACanvas: TCanvas);begin  ACanvas.GradientFill(Rect(0, 0, ACanvas.Width, ACanvas.Height), clRed, clBlue, gdVertical);end; This works under Linux without any problems. Under Windows it doesn't. So I made some tests with TPanels and their onPaint events. Under Linux it makes no difference wether you pass Rect(0, 0, Panel.Width, Panel.Height) or  Rect(0, 0, Panel.Canvas.Width, Panel.Canvas.Height) to GradientFill, whereas under Windows only the first version is working correctly. If you increase the height of the panels, you can see that there definitely is a gradient, but it seems to run over the size of the form (?). Since there is no Canvas.Parent I'm running into problems here. Any ideas how this can be solved? Screenshots and test-project attached. Thanks Chris ---------------------------------------------------------------------- Fish · 2020-05-21 15:09 No one? No idea? No hint? No comment? I worked around the problem by passing height and width as arguments, which is working as expected. But it still would be interesting whether this different behavior is intended or a bug. ---------------------------------------------------------------------- winni · 2020-05-21 15:51 Hi! Don't rely on the dimensions of the canvas. It is known to be buggy in Windows. Pass the width and the height as parameter to your function. Take the width and height from the component and not from the component.canvas. Winni ---------------------------------------------------------------------- Fish · 2020-05-23 07:13 QuoteIt is known to be buggy in Windows. Ok, thank you for this information.