开发者

What's the best way to "dim" background of winform while displaying a dialog?

开发者 https://www.devze.com 2022-12-24 20:31 出处:网络
I\'d like to implement a feature in my application where show a dialog to the user, and the main 开发者_运维百科form (similar to how jQuery looks).My only idea is to take a screenshot of the form, pla

I'd like to implement a feature in my application where show a dialog to the user, and the main 开发者_运维百科form (similar to how jQuery looks). My only idea is to take a screenshot of the form, place it as the background of a panel (with opacity to my liking) then pushing the panel over everything on the form. I have to believe there is a better way of doing this, any suggestions?


The Opacity property is what you need to "dim" a form. You'll need to create an overlay, my code in this thread shows how to do this.

Be careful to not make it look like your program is displaying a UAC prompt. While perhaps appropriate in browsers, the user will never have any trouble recognizing that a window overlaid by a dialog is disabled. Controls paint themselves differently to make it clear.


Why not just set the opacity to something like 50% of the parent window just before launching the modal dialog and then back to 100% when the modal dialog is dismissed? This isn't exactly what you're asking for serves the same function for the end user.

If you do want to do something like your JQuery example you would indeed have to do the screen cap/augment/set as background idea that you described.


I know this is an old thread but if still interested you can take a look at this project.

Download Project

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号