I have tested the following source code, here in this code the onpaint event fired from the Form, but in here the paint event doesnt work whenever drag the form the paint event triggered.
So I read an article written like this:
"This is the order of the initialization.
OnCreate -> OnShow -> OnActivate -> OnPaint -> OnResize -> OnPaint ... and so on.
OnPaint, OnResize
Events like OnPaint and OnResize are always called after the form is initially created, but are also called repeatedly. OnPaint occurs before any controls on the form are painted (use it for special painting on the form)."
Here is the question then if "use it for special painting on the form" is written why does the following code doesnt work properly.
Thanks
procedure TForm1.FormPaint(Sender: TObject);
var
r:TRect;
begin
r.TopLeft:=bevel1.ReadBounds.TopLeft;
r.BottomRight:=bevel1.ReadBounds.BottomRight;
Bevel1.Canvas.Pen.Color:=clRed;
Bevel1.Canvas.Brush.Color:=clRed;
Bevel1.Canvas.Rectangle(r);
Bevel1.Canvas.FillRect(r);
end;