AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

Sechseckige Komponente

Ein Thema von Narayana · begonnen am 17. Mai 2005 · letzter Beitrag vom 20. Mai 2005
 
Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#14

Re: Sechseckige Komponente

  Alt 19. Mai 2005, 21:54
hier mal eine Sechseckkomponente (farbe im Create weg machen und dann kannst du davon ableiten)
Delphi-Quellcode:
  TSechsEck = class(TCustomControl)
  protected
    procedure SetParent(AParent: TWinControl); override;
  public
    constructor Create(AOwner: TComponent); override;
    procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
  end;

constructor TSechsEck.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Color := clBlue;
  SetBounds(Left, Top, 100, 100);
end;

procedure TSechsEck.SetBounds(ALeft, ATop, AWidth, AHeight: Integer);
var LPoints: Array[0..5] of TPoint;
    LPart: Integer;
begin
  if Assigned(Parent) then
  begin
    LPart := Round(AHeight / 4);
    LPoints[0] := Point(AWidth div 2 - 1, 0);
    LPoints[1] := Point(AWidth - 1, LPart);
    LPoints[2] := Point(AWidth - 1, LPart * 3);
    LPoints[3] := Point(AWidth div 2 - 1, AHeight - 1);
    LPoints[4] := Point(0, LPart * 3);
    LPoints[5] := Point(0, LPart);
    SetWindowRgn(Handle, CreatePolygonRgn(LPoints, length(LPoints), ALTERNATE), True);
  end;
  inherited SetBounds(ALeft, ATop, AWidth, AHeight);
end;

procedure TSechsEck.SetParent(AParent: TWinControl);
begin
  inherited SetParent(AParent);
  if Assigned(Parent) then
    SetBounds(Left, Top, Width, Height);
end;
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:27 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz