1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
type
TMonCompo = class(TGRaphicControl)
Protected
Procedure Paint; Override;
Public
Constructor Create(AOwner : Tcomponent); Override;
End;
Constructor TMonCOmpo.Create(AOwner : TComponent);
Begin
Inherited Create(AOwner);
Self.ControlStyle := Self.ControlStyle - [csOpaque];
End;
Procedure TMonCompo.Paint;
Begin
Inherited Paint;
Self.Canvas.Brush.Style := bsClear;
Self.Canvas.FillRect(Self.Canvas.ClipRect);
Self.Canvas.Brush.Style := bsSolid;
Self.Canvas.FillRect(Rect(50, 50, 150, 150));
End;
procedure TForm1.FormCreate(Sender: TObject);
begin
Self.DoubleBuffered := True;
Self.MC := TMonCompo.Create(Self);
Self.MC.Parent := Self;
Self.MC.SetBounds(100, 100, 200, 200);
End; |
Partager