Derek
Derek

Reputation: 249

Grey out entire windows screen

I am currently working on a windows form application (C# visual studio).

Upvotes: 0

Views: 3372

Answers (2)

Ashish Sahu
Ashish Sahu

Reputation: 335

easiest way:use XAML pop-up as described below

<Popup x:Name="pop" IsOpen="False" >

</Popup> 

For more details visit below link. http://www.c-sharpcorner.com/UploadFile/mahesh/using-xaml-popup-in-wpf/

After this to blur the main grid on eventhandler for the event which shows the pop-up,set the opacity as shown in below C# code

if (pop.IsOpen == false)    
{    
pop.IsOpen = true;    
grdMain.Opacity = 0.4;    
}    
else    
{    
pop.isopen=false;    
}    

Upvotes: 0

SASS_Shooter
SASS_Shooter

Reputation: 2216

Answers to your question:

  • Is it possible to grey out the entire windows screen when a button is pressed? You can put a control like a panel over the entire window and hide it. In the button event you then make it visible. Set the background of the panel to gray and vary the transparency to adjust it so until your window visibility beneath it looks right. This will force the window into a "modal mode" without any way out. So you better have logic for undoing this as well.
  • How can I work that out? Make sure you have some event such as completion of an event or query to hide the control or the user will never get back into your application again.
  • Is it also possible to grey out the entire screen but leaving an ungreyed space in the middle for a message box for showing some text? That is more complex and to be honest with you I haven't played with WinForm is some time -- instead doing WPF for desktop. You MAY be able to use clipping but you will have to do quite a bit of research into how to do it. Use Google -- it can be your best friend.

Upvotes: 3

Related Questions