The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Form with alpha transparency

Does anubody know abou a component or example for making form iregural shaped using png(or bmp with alpha channel)?
It is all about winapi "updatelayeredwindow",but when i finally make my form realy irregular with smooth shedows and borders all controls (buttons etc..) dissapear
alexandar
Monday, August 11, 2008
 
 
Codeproject has what your looking for...

http://www.codeproject.com/KB/miscctrl/customcsforms.aspx

Is one example and i've seen a few others as well.
Gavin Roberts Send private email
Monday, August 11, 2008
 
 
Not,this is not what i'm looking for.It uses just 1 color value for transparency and as a result final form is very pixelated at edges.I need a way to set form transparency acording to alpha channel,so smooth borders and shadows are possible.It must be done using winapi updatelayeredwindow function(i don't know if there s any other way).As example of such aplications check yahoo widgets ot opera widgets

Monday, August 11, 2008
 
 
I haven't tested it but maybe this is what you need?

http://www.pinvoke.net/default.aspx/user32/UpdateLayeredWindow.html
Gavin Roberts Send private email
Wednesday, August 13, 2008
 
 
Maybe it is,I don't speak Italian...
Heh just kidding,it is probably what I'm looking for but it is strange that nobody made VCL component for this,it is very powerfull function regarding UI design

Wednesday, August 13, 2008
 
 
A layered window does not support WS_CHILD, that's why all the controls are gone. You have to use graphics and other low level apis to build your own controls. It's fun to do but be aware of your schedule.
Phil
Wednesday, August 13, 2008
 
 
What VCL? Delphi?

Here you go:

  TForm.Alphablend
  TForm.Alphablendvalue...
Marck
Sunday, August 17, 2008
 
 
> a component or example for making form iregural shaped

Try this one ... I'm sure there are several more out there.
http://www.woll2woll.com/1stClass.html
TDH Send private email
Wednesday, August 20, 2008
 
 
@ TDH
Thanks,but it is not what i need.If you look at edges of their forms you'll see pixelisation and rude look,that's because it allows only one color to be transparent.
If it is done with alpha channel then whole range of gray scale is transparent and as a result borders are smooth like in photoshop when you do with layers
topic starter
Thursday, August 21, 2008
 
 
Hi Alexander.

There is no way to have common Windows controls on a layered (alpha blended) window.

HOWEVER... you can fake it!

This is what you can do: create a second, smaller, non-alpha blended window and put all your controls there. This window will later overlap the main, alpha blended, window.

Now, what you need to do when you display the alpha blended window is to show the control container window as well - in the proper position above the alpha layered window - and use the API to make the alpha layered window the owner of the container window, like this:

Call SetWindowLong(ContainerHwnd, GWL_HWNDPARENT, AlphaHwnd)

Note that this is NOT the same as Setparent! It takes care of z-order issues and makes sure the control container window NEVER goes behind the alpha blended window.  Minimize the alpha layered window and the owned control container window minimizes as well.

You also need to sub-class the alpha blended window so when the user moves it you move the owned control container window along with it.

Hope this helps!
Jorge Coelho Send private email
Tuesday, August 26, 2008
 
 
@ Jorge
Thanks for that sugestion,I thought aboy doing exactly the same but hard part is to make both windows moving in the same tim.
But according to tour winstep site screenshots you know that it can be done very well.I'll try this
alexandar
Sunday, August 31, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz