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.
LVL 1
SpannerBracketAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.