Solved

Transparent Form

Posted on 1998-06-30
11
383 Views
Last Modified: 2010-04-04
Hi, Can any one tell me how to create a transparent form in Delphi 3?
By transparent, I mean that the form it self is invisible, while the complementary objects remain visible!
  I will apreciate very much if you can put an example source code in the answer!
0
Comment
Question by:jconde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1356708
Hi jconde,

What do you mean exactely with a transparent form? What do you want to accomplish?

Zif.
0
 
LVL 7

Author Comment

by:jconde
ID: 1356709
Edited text of question
0
 
LVL 1

Expert Comment

by:Greedy
ID: 1356710
hummm...do you want the user to be able to move this form (quickly)...oh actually I think I have a quick way they could even move it...when they want to move this window change it to outline drag instead of full contents drag...then after the move you read in the section of the screen memory that would be under the window and display this as a background bitmap...I know all the routines but making a source code example will eat too much time from me and besides Ziffy needs the points to be #1.  To get an example of reading in the screen do a deja news search for 'screen capture routine with delphi'  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
BoRiS earned 100 total points
ID: 1356711
jconde

(Quote)Use a TForm. Override its CreateParams method and Or the WS_EX_TRANSPARENT style into Params.Exstyle after you called the inherited method. Add a handler for the WM_ERASEBKGND message and have it return msg.result := 1
*without* calling the inherited handler. That gives you about the best
Windows has on offer re transparency. (Unquote Peter below TeamB)

So I did Something like this...

first create the procedure CreateParams...

procedure CreateParams( var Params: TCreateParams );

then passed it like so

procedure TForm1.CreateParams( var Params: TCreateParams );
begin
  inherited CreateParams( Params );
  Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;

then just to check I placed a button on the for that would create a Tedit on the form...

procedure TForm1.Button1Click(Sender: TObject);
var       PEdit : TEdit;
begin
  PEdit := TEdit.Create(Form1 );
  PEdit.Parent := Self;
  inc( n, 20 );
  PEdit.Top := n;
  PEdit.Left := n;
  PEdit.color := clGray;
  PEdit.Visible := true;
end;

hope this helps....

Later
BoRiS
0
 
LVL 4

Expert Comment

by:jeurk
ID: 1356712
Hello,
I suggest you use the following component that you will find
at
http://www.wirtschaft.TU-Ilmenau.DE/~aeg/
look in the self made section for a component called
tshapeform
it free and it's the best transparent form component ever trust me.
I'm using it.
I hope it helps.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1356713
Don't forget the override in the CreateParams.
0
 
LVL 7

Author Comment

by:jconde
ID: 1356714
Thanks everyone,  I'm really pleased to see this site working better than the delphi news group.  Hats off to you all!!!
0
 
LVL 7

Author Comment

by:jconde
ID: 1356715
Thanx jeurk,roint,boris
0
 
LVL 1

Expert Comment

by:sviksna
ID: 1356716
Hello,
You can use this way:
at first, you must set, tahat the form.borderstyle is bsNone

and then use

procedure TForm1.FormCreate(Sender: TObject);
begin
brush.style := bsClear;
end;

if you remove form, you must repain the form. So that's all. I think it's very esay and looks great.

Sandis Viksna,
http://www.ogre2vsk.edu.lv/viksna/
0
 
LVL 1

Expert Comment

by:sviksna
ID: 1356717
sorry,
not "you must repain the form."
but "you must repaint the form."

bye
0
 

Expert Comment

by:joanita
ID: 1356718
1. Sandis Viksna solution (borderstyle bsnone and brush.style bsClear) is by far the best and simplest.
Do not forget to have an arrangement to close the form ie by a timer or mouse/key board event as all ' visual handles' to the form are  lost with bsnone as border style.
2.If you need a cirular or elliptical shaped form try this
procedure TMyShape.FormCreate(Sender: TObject);
var
R : HRgn;
x1,x2,y1,y2 : integer;
begin
{x1 := ....
...
..}
R := CreateEllipticRgnIndirect(Rect(x1,y1,x2,y2));
SetWindowRgn(Handle,R,True);
end;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question