was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

47 Visitors Online


 
...eine Form mit abgerundeten Ecken erstellen?
Autor: Horst Kniebusch
Homepage: http://members.tripod.de/Kniebusch
[ Tip ausdrucken ]  

Tip Bewertung (40):  
     




{
  Die CreateRoundRectRgn lässt eine Form mit abgerundeten Ecken erscheinen.

  The CreateRoundRectRgn function creates a rectangular
  region with rounded corners
}

procedure TForm1.FormCreate(Sender: TObject);
var
  
rgn: HRGN;
begin
  
Form1.Borderstyle := bsNone;
  rgn := CreateRoundRectRgn(0,// x-coordinate of the region's upper-left corner
    
0,            // y-coordinate of the region's upper-left corner
    
ClientWidth,  // x-coordinate of the region's lower-right corner
    
ClientHeight, // y-coordinate of the region's lower-right corner
    
40,           // height of ellipse for rounded corners
    
40);          // width of ellipse for rounded corners
  
SetWindowRgn(Handle, rgn, True);
end


{ The CreatePolygonRgn function creates a polygonal region. }


procedure TForm1.FormCreate(Sender: TObject);
const
  
C = 20;
var
  
Points: array [0..7] of TPoint;
  h, w: Integer;
begin
  
h := Form1.Height;
  w := Form1.Width;
  Points[0].X := C;     Points[0].Y := 0;
  Points[1].X := 0;     Points[1].Y := C;
  Points[2].X := 0;     Points[2].Y := h - c;
  Points[3].X := C;     Points[3].Y := h;

  Points[4].X := w - c; Points[4].Y := h;
  Points[5].X := w;     Points[5].Y := h - c;

  Points[6].X := w;     Points[6].Y := C;
  Points[7].X := w - C; Points[7].Y := 0;

  SetWindowRgn(Form1.Handle, CreatePolygonRgn(Points, 8, WINDING), True);
end;


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners