• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3078
  • Last Modified:

Creating a transparent panel in Delphi 2009

I have a form with a number of elements on (edit boxes, buttons, labels).
The form is loaded via a backend process that takes 5-10 secs (and the use can refresh the form at will)

While its loading, I would like to leave the form visible with the egg timer, but it would be nice to grey out or blur the contents of the form while the update is happening.

The obvious way of doing this would be to display a panel covering the whole form, but with its alpha layer turned on to 50% or so, to allow tranparency.
The OS is XP or Vista.

Is this fairly easy to do?

Thanks
SF
0
sheepfarmer
Asked:
sheepfarmer
  • 2
  • 2
  • 2
4 Solutions
 
MerijnBSr. Software EngineerCommented:
How about you cover it with another captionless window. You can set the transparency of a window very easy in Delphi, just change the AlphaBlend properties.
0
 
Geert GruwezOracle dbaCommented:
how about just setting that form ApphaBlend true and AlphaBlendValue to 128 (halfway) during the loading operation
0
 
sheepfarmerAuthor Commented:
I am trying to keep the original window solid (i.e. not to see any background behind) so MerijnB window trick seems to fit the bill and works reasonably well.

However, I need the captionless window to completely cover the calling form window where ever it appears on the screen (i.e. its not always centered).

How can I set the top/left position and width/height of the captionless window and panel to match the calling form window?

Thanks
SF
0
Independent Software Vendors: 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!

 
Geert GruwezOracle dbaCommented:
i hope it's on the same monitor ...

set the panel of the captionless window to alClient

give the overlapping window the top,left corner and with,height of the calling form
and use to set the client area size
the topleft of the client area of the overlap should match the top left of the calling form

calling (left, top) = overlapping.clienttoscreen(0, 0)
overlapping.(left, top) = overlapping.clienttoscreen(0, 0) - calling(left, top)
in the create of the overlapped

overlapped.left := overlapped.clienttoscreen(0,0).left - calling.left
overlapped.top := overlapped.clienttoscreen(0,0).top - calling.top




0
 
MerijnBSr. Software EngineerCommented:
See this example (form3 is the transparent window).
procedure TForm2.Button1Click(Sender: TObject);
var TopLeft: TPoint;
begin
 TopLeft := ClientToScreen(ClientRect.TopLeft);
 Form3.SetBounds(TopLeft.X, TopLeft.Y, (ClientRect.Right - ClientRect.Left), (ClientRect.Bottom - ClientRect.Top));
 form3.show();
end;

Open in new window

0
 
sheepfarmerAuthor Commented:
Thanks, I got something workable from your suggestions.

SF
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now