Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Transparent Form

Posted on 1998-06-30
11
Medium Priority
?
387 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Accepted Solution

by:
BoRiS earned 400 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 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