Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to create a polygon-shaped form using regions Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Create a polygon-shaped form using regions 30-Aug-02
Category
Graphic
Language
Delphi 2.x
Views
62
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas 

How to create a polygon-shaped form using regions

Answer:

To start with, we need to make an array of points of all corners of the form (there 
can be as many as you want). Next we use the Windows API call CreatePolygonRgn to 
get a handle to the region we have just defined. Finally we need to set this region 
the window we want to be that shape using another API call SetWindowRgn. To see 
this in effect create a new project and in the forms onCreate event have:

1   procedure TForm1.FormCreate(Sender: TObject);
2   var
3     Region: HRgn;
4     Points: array[0..11] of TPoint;
5   begin
6     {Define the points of a W shape}
7     Points[0] := Point(0, 0);
8     Points[1] := Point(50, 0);
9     Points[2] := Point(180, 200);
10    Points[3] := Point(218, 100);
11    Points[4] := Point(256, 200);
12    Points[5] := Point(385, 0);
13    Points[6] := Point(435, 0);
14    Points[7] := Point(256, 300);
15    Points[8] := Point(218, 200);
16    Points[9] := Point(180, 300);
17    {Define the region}
18    Region := CreatePolygonRgn(Points, 10, ALTERNATE);
19    {Set the window to have the above defined region}
20    SetWindowRgn(Handle, Region, True);
21  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC