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 transparent form which is still moveable 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 transparent form which is still moveable 03-Oct-02
Category
Win API
Language
Delphi 2.x
Views
66
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius 

How to create a transparent form which is still moveable

Answer:

You can achieve a transparency effect by creating a window region that includes 
only the controls on the form but not the background. Making a window transparent 
and still moveable:

1   procedure TForm1.Button2Click(Sender: TObject);
2   var
3     frmRegion, tempRegion: HRGN;
4     i: Integer;
5     Arect: TRect;
6   begin
7     frmRegion := 0;
8     for I := 0 to ControlCount - 1 do
9     begin
10      { create a region for the control }
11      aRect := Controls[i].BoundsRect;
12      { coordinates have to be window-relative, not client area relative }
13      OffsetRect(aRect, clientorigin.x - left, clientorigin.y - top);
14      tempRegion := CreateRectRgnIndirect(aRect);
15      { merge the region with the "summary" region we are building }
16      if frmRegion = 0 then
17        frmRegion := tempRegion
18      else
19      begin
20        CombineRgn(frmRegion, frmRegion, tempRegion, RGN_OR);
21        DeleteObject(tempRegion);
22      end;
23    end;
24    { create a region for the caption and menu bar and add it to the summary }
25    tempregion := CreateRectRgn(0, 0, Width, GetSystemMetrics(SM_CYCAPTION) +
26      GetSystemMetrics(SM_CYSIZEFRAME) +
27      GetSystemMetrics(SM_CYMENU) * Ord(Menu < > nil));
28    CombineRgn(frmRegion, frmRegion, tempRegion, RGN_OR);
29    DeleteObject(tempRegion);
30    SetWindowRgn(handle, frmRegion, true);
31  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