Articles   Members Online: 3
-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 make Any-Shaped Form ( The Hard-Code ) 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
28-Oct-02
Category
VCL-Forms
Language
Delphi 4.x
Views
30
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Abu Zant Ruslan

Wel, this is a hard-coded application, ONLY for people interested in knowing more, 
it describes another way of doing starnge shaped forms !!

Answer:

Well, Declare these 2 sentences to your PROTECTED declaration 

procedure EvEraseBkgnd(var M: tMessage); message WM_ERASEBKGND;
procedure EvNcHitTest(var M: tMessage); message WM_NCHITTEST;

Then Of Course, add them in the body code !! 
1   procedure tForm1.EvEraseBkgnd(var M: tMessage);
2   begin
3     { No Erase Window Background.... }
4     M.Result := 1;
5   end;
6   
7   procedure tForm1.EvNcHitTest(var M: tMessage);
8   begin
9     inherited;
10    { If Hit in Client Area then simulate hit in Caption Area }
11    if M.Result = HTCLIENT then
12      M.Result := HTCAPTION;
13  end;
14  make the following OnFormPaint procedure.. 
15  
16  procedure TForm1.FormPaint(Sender: TObject);
17  var
18    Buffer: tBitmap;
19  begin
20    Buffer := tBitmap.create;
21    Buffer.LoadFromResourceName(hinstance, 'FORM');
22    Bitblt(Canvas.handle, 0, 0,
23      Buffer.width, Buffer.height,
24      Buffer.canvas.handle, 0, 0,
25      SrcCopy);
26    Buffer.free;
27  end;

And On Your Form, Put Any Buttons Or TEdits Or Anything You Want To Add, Try Your 
Form, I think it is working just as it used to work all the time, that is true, 
this is not the secret, the big part is here 

OnFormCreate Procedure Needs To Be Added :-)) 

28  procedure TForm1.FormCreate(Sender: TObject);
29  var
30    Region1: array of tPoint;
31    Region1hrgn: hRgn;
32  begin
33    SetLength(Region1, 59);
34  
35    Region1[0].X := 12;
36    Region1[0].Y := 6;
37    Region1[1].X := 484;
38    Region1[1].Y := 6;
39    Region1[2].X := 484;
40    Region1[2].Y := 7;
41    Region1[3].X := 486;
42    Region1[3].Y := 7;
43    Region1[4].X := 486;
44    Region1[4].Y := 8;
45    Region1[5].X := 487;
46    Region1[5].Y := 8;
47    Region1[6].X := 487;
48    Region1[6].Y := 9;
49    Region1[7].X := 488;
50    Region1[7].Y := 9;
51    Region1[8].X := 488;
52    Region1[8].Y := 10;
53    Region1[9].X := 489;
54    Region1[9].Y := 10;
55    Region1[10].X := 489;
56    Region1[10].Y := 12;
57    Region1[11].X := 490;
58    Region1[11].Y := 12;
59    Region1[12].X := 490;
60    Region1[12].Y := 285;
61    Region1[13].X := 489;
62    Region1[13].Y := 285;
63    Region1[14].X := 489;
64    Region1[14].Y := 287;
65    Region1[15].X := 488;
66    Region1[15].Y := 287;
67    Region1[16].X := 488;
68    Region1[16].Y := 288;
69    Region1[17].X := 487;
70    Region1[17].Y := 288;
71    Region1[18].X := 487;
72    Region1[18].Y := 289;
73    Region1[19].X := 486;
74    Region1[19].Y := 289;
75    Region1[20].X := 486;
76    Region1[20].Y := 290;
77    Region1[21].X := 484;
78    Region1[21].Y := 290;
79    Region1[22].X := 484;
80    Region1[22].Y := 291;
81    Region1[23].X := 101;
82    Region1[23].Y := 291;
83    Region1[24].X := 100;
84    Region1[24].Y := 290;
85    Region1[25].X := 99;
86    Region1[25].Y := 290;
87    Region1[26].X := 98;
88    Region1[26].Y := 289;
89    Region1[27].X := 97;
90    Region1[27].Y := 288;
91    Region1[28].X := 96;
92    Region1[28].Y := 287;
93    Region1[29].X := 95;
94    Region1[29].Y := 286;
95    Region1[30].X := 95;
96    Region1[30].Y := 284;
97    Region1[31].X := 94;
98    Region1[31].Y := 283;
99    Region1[32].X := 94;
100   Region1[32].Y := 200;
101   Region1[33].X := 93;
102   Region1[33].Y := 199;
103   Region1[34].X := 93;
104   Region1[34].Y := 198;
105   Region1[35].X := 92;
106   Region1[35].Y := 197;
107   Region1[36].X := 91;
108   Region1[36].Y := 196;
109   Region1[37].X := 90;
110   Region1[37].Y := 195;
111   Region1[38].X := 89;
112   Region1[38].Y := 194;
113   Region1[39].X := 88;
114   Region1[39].Y := 194;
115   Region1[40].X := 87;
116   Region1[40].Y := 193;
117   Region1[41].X := 14;
118   Region1[41].Y := 193;
119   Region1[42].X := 13;
120   Region1[42].Y := 192;
121   Region1[43].X := 12;
122   Region1[43].Y := 192;
123   Region1[44].X := 11;
124   Region1[44].Y := 191;
125   Region1[45].X := 10;
126   Region1[45].Y := 190;
127   Region1[46].X := 9;
128   Region1[46].Y := 189;
129   Region1[47].X := 8;
130   Region1[47].Y := 188;
131   Region1[48].X := 8;
132   Region1[48].Y := 187;
133   Region1[49].X := 7;
134   Region1[49].Y := 186;
135   Region1[50].X := 7;
136   Region1[50].Y := 184;
137   Region1[51].X := 6;
138   Region1[51].Y := 183;
139   Region1[52].X := 6;
140   Region1[52].Y := 12;
141   Region1[53].X := 7;
142   Region1[53].Y := 11;
143   Region1[54].X := 7;
144   Region1[54].Y := 10;
145   Region1[55].X := 8;
146   Region1[55].Y := 9;
147   Region1[56].X := 9;
148   Region1[56].Y := 8;
149   Region1[57].X := 10;
150   Region1[57].Y := 7;
151   Region1[58].X := 11;
152   Region1[58].Y := 7;
153 
154   Region1hrgn := CreatePolygonRgn(Region1[0], 59, 2);
155 
156   SetWindowRgn(Handle, Region1hrgn, True);
157 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