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

Semi-Transparent Delphi Forms

Ive successfully mastered the CreateRgn commands and created myself a skinnable form.  Ive also taken it one step further, towards semi transparent areas, by hiding the form, grabbing the background and using it accordingly.  This however is a cheap nasty way and is slow and flickery.  Is there a more efficient way of achieving semi transparent areas?  I need to get the area of the desktop behind my form in a TBitmap so i can process it.
0
SpannerBracket
Asked:
SpannerBracket
1 Solution
 
czykyCommented:
If I take what you are trying to do corrrectly.....

The flickeriness may be due to your form repainting its background (to a default gray) everytime it gets a paint msg. (By default, anytime there's a paint, the whole form gets erased first with a background fill.)

If so, the quick fix to this is to add a method to your form:

(in form definition)
  private
    procedure WMEraseBkgnd(var Msg : TWMEraseBkgnd); message WM_ERASEBKGND;
..
..
..
(in form code)
procedure TForm1.WMEraseBkgnd(var Msg: TWMEraseBkgnd);
begin
      if (csDesigning in ComponentState) then
        inherited
  else
        Msg.Result := 1;
end;

Returning a 1 tells windows you've taken care of erasing the background yourself so windows needn't bother.

Judicious use of this may help your flickering.

Regards.
0
 
intheCommented:
hello,
i would use the component coolform:
http://www.lawrenz.com/coolform/
it is made for this purpose where you want to use bitmap etc for shape of form ,the rest of the form is masked out.

Regards Barry
0
 
bryan7Commented:
listenning
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 
SpannerBracketAuthor Commented:
That's a great start, i had been wondering how to remove the little bits of flicker when resizing forms and the like, but my problem is more the fact that i have to hide the form, wait for windows to refresh, grab it and then show the form. And I have to do this everytime i move the form to a new position.  This takes nearly a second to do, thats what i meant by flicker, you visibly see the form dissapear while it grabs the background.  I was hoping for a whole new approach to the problem, but maybe there is no way at the moment.
0
 
gandalf_the_whiteCommented:
listening...
0
 
topkapiCommented:
listening
0
 
garizpeCommented:
I have the answer for your problem, but i need to return to my office, i have a the source that fix your problem, tomorrow i wil answer you

Regars until then....

Gilberto Arizpe
0
 
ZifNabCommented:
have you read this article?

http://www.undu.com/Articles/990621c.html

Regards, Zif.
0
 
SpannerBracketAuthor Commented:
Ive had a read through... i can already do the skinning part and the irregular window shape, its semi transparent to desktop areas where i'm having trouble =(

Cheers
Spanner
0
 
trestoCommented:
This made my window transparent!

procedure TForm1.FormCreate;
begin
  SetWindowPos(Handle,hwnd_TopMost,Left,Top,Width,Height,swp_NoRedraw+swp_ShowWindow);
end;
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

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