Click here to Skip to main content
15,891,993 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hi Friends
I want to control opacity of form. i can do it. but my problem is when i decrease opacity of form then opacity of content of form like button, picture box etc. are also decrease. and i want to decrease opacity of form only not his content's opacity. please help me.
Posted
Comments
Sergey Alexandrovich Kryukov 14-Apr-11 13:06pm    
Vote of 5 for a tricky question.
--SA

Unfortunately, it is not possible in pure .NET, to best of my knowledge.

In native Windows, there is a technique of "Layered windows".

See this: A non-rectangular top window with click-through shadow along the edge?[^], check out the Answer by mbue. I did not test this technique. I asked mbue about this possibility and see that there is no easy way to make it with available controls: you would need to re-create all using bitmaps, which does not sound realistic at all. Please see the reference about for explanation of technique and the summary of our discussion.

—SA
 
Share this answer
 
v2
Comments
Antaru 14-Apr-11 4:52am    
Thank You SA
Sergey Alexandrovich Kryukov 14-Apr-11 13:06pm    
You're very welcome.
I decided to vote 5 for your Question as a tricky one, but in practice I think you should ease up this requirement and keep it simpler.
Thanks for accepting this Answer.

Good luck, call again.
--SA
Antaru 14-Apr-11 15:19pm    
thnaks again
You could create a standard form with the opacity, and then overlay it with another (modeless, borderless, and transparent background) form which has all of the desired controls on it. Of course, you'd have to manage all of the form interaction between the two yourself. It's a hassle - if I were you, and if you absolutely need that kind of functionality, I'd consider using WPF instead of WinForms.
 
Share this answer
 
Comments
Antaru 14-Apr-11 4:52am    
Thank you john
Sergey Alexandrovich Kryukov 14-Apr-11 15:48pm    
John, it is not possible with WPF as well as with Forms because it is not possible in native Windows. One remote possibility is layered windows (which I never tried) would strongly defeat the purpose of the UI library and can be very difficult, more difficult with WPF, or just impossible.

Please see my Answer and references Answer by mbue.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900