Drawing form lazarus / 31-LCL ---------------------------------------------------------------------- jaytolkte · 2018-10-03 08:28 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? ---------------------------------------------------------------------- wp · 2018-10-03 09:51 I don't understand. What do you want to achieve? Paint the border of a groupbox in a different color? ---------------------------------------------------------------------- jamie · 2018-10-04 22:44 you should be doing the painting within the Paint Handler of each control and then call the Repaint of the parent control.  This will force a proper sequence.