views:

148

answers:

2

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?

+1  A: 

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.

Paul Sasik
+5  A: 

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.

Hans Passant
+1: This is an easier approach than mine, as it doesn't require subclassing controls.
Reed Copsey
Very nice solution. Although, I must say " the user will never have any trouble recognizing that a window overlaid by a dialog is disabled" may be giving some users too much credit. ;)
stout