Drawing on form lazarus / 31-LCL ---------------------------------------------------------------------- staratel20 · 2016-03-14 08:40 Good day. When I try to draw on form , I've put that simple code on ButtonClick: 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   with Canvas do  begin       Pen.Color:=clGreen;       Canvas.Rectangle(20,20,100,60);  end;it works nice, but if I put the GroupBox in the same coordinates(or interleaving coordinates) - GroupBox draws after my Rectangle. So, I put the same code in OnPaint method. Works well - I see my rectangle above GroupBox. But! If now I change the color of GroupBox to any, except clDefault - GroupBox again above my Rectangle. I need Rectangle above all of components of form. How can I reach it? ---------------------------------------------------------------------- howardpc · 2016-03-14 09:31 You have to make your Rectangle a control, not just a line of painting code. That means it has a handle, and is a window in its own right, and you can call BringToFront if you want it to show above other controls parented on the same form. In the LCL TGroupBox is an OS widget drawn by the OS. So you have no direct control over when it gets drawn. ---------------------------------------------------------------------- staratel20 · 2016-03-14 10:06 But I don't need control. My task - is to highlight some different controls by blinking rectangle when they are painted on form(in common case I know about them only Top,Left,Width,Height - enough to do that). So is exists way to do that? ---------------------------------------------------------------------- Mando · 2016-03-14 12:29 Hello staratel20: I made this example for you. I think it's what you need. Test it. Regards ---------------------------------------------------------------------- staratel20 · 2016-03-14 13:22 Mando: Yes, that's really what I need. But this result I already done: QuoteI put the same code in OnPaint method. Works well - I see my rectangle above GroupBox.In your example, put the Button2 on GroupBox1, write on FromCreate: 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 RadioGroup1.Items.Add('Button2'); and try the same for Button2. Rectangle can't be seen. But if you Copy/Paste this Button2 from GroupBox1 to a Form1 - trick works. The problem is to display rectangle when control is on GroupBox. I achieve that too. But if change color of GroupBox to [for ex.] Green - you'll not see the rectangle. ---------------------------------------------------------------------- Mando · 2016-03-15 09:34 Hello staratel20: Try this new version. regards. ---------------------------------------------------------------------- staratel20 · 2016-03-15 12:07 Mando: at this time code grew up to a good and useful trick . I'll make it more simple and add to Wiki, because it's the basic important thing. A lot of thanks.