Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#5

AW: Shape - Rahmen

  Alt 27. Okt 2011, 11:47
wenn Du es nicht als Komponente brauchst kannst Du auch so reinfummeln
Delphi-Quellcode:
type
  TShape=Class(ExtCtrls.TShape)

  private
    procedure Paint; override;
  End;

  TForm1 = class(TForm)

..........


implementation

{$R *.dfm}
procedure TShape.Paint;
var
  X, Y, W, H, S: Integer;
  C:TCanvas;
begin
  inherited;
  if Shape in [stRectangle, stSquare] then
    begin
        C := Tcanvas.Create;
      try
      c.Handle := Canvas.Handle;
      c.Pen.Width := 5;
      c.Pen.Color := clBlue;
      X := c.Pen.Width div 2;
      Y := X;
      W := Width - c.Pen.Width + 1;
      H := Height - c.Pen.Width + 1;
      c.MoveTo(x,y);
      c.LineTo(X,y + h);
      c.MoveTo(x + w,y);
      c.LineTo(X + w,y + h);
      Pen.Width := 1;
      finally
        C.Free;
      end;

    end;
end;
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat