I have written a simple program (using Delphi XE7); it has a TImage and a TPaintBox (partially over the Timage). In the FormPaint procedure I am calling "BringToFront" and then drawing a (filled) rectangle. The rectangle appears under the image.
procedure TForm1.FormPaint(Sender: TObject);
begin
with paintbox1 do
begin
BringToFront;
canvas.Rectangle(0,0,width-1,height-1);
end;
end;
This is a image of the program window:
I expected the rectangle to be over the image. What am I doing wrong? :)