I don’t want the user to resize the window so I did ResizeMode="NoResize". But then the minimize button also disappears and only the X button is visible. Is there a way to keep the minimize button?
WPF Windows Overview. ResizeMode="CanMinimize"
Related
How to popup a child form when I click the button. I want to child winform to be in the centre of the screen and the whole background screen should be blurred. and a small close button should be visible in the right corner of the form. I have searched the web but found nothing.
Using Winforms.
Make a new windows form. it has a close button by default. Set it default position to center screen. Then on your button click.
Lets say your new form is Form2
Form2 frm = new Form2();
frm.ShowDialog();
it will not make the rest of screen blurred but user will not be able to do anything with it.
For blurry effect a workaround has been posted here
You can trigger event from click button like this
Form form1=new Form();
form1.show;
and after that to blurr the parent screen use opacity property of and increase or decrease it accord to your requirement.
you can also control the transparency of the child form using a timer and increase paacity with timer click it will make it more dynamic and interactive.
I am currently working on a windows form application (C# visual studio).
Is it possible to grey out the entire windows screen when a button is pressed?
How can I work that out?
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?
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.
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;
}
I'd like to create a popup dialog box in silverlight with a Input-box and a Ok and Cancel button. And the speciality of popup should be that It should not fade-out the master-background screen. And the backGround screen should be scrollable and visibile clearly.
Currently i am using just a Javascript Prompt box on my screen, but its look and feel is not so pleasing.. i am looking for something having a smoother look.
Using Silverlights ChildWindow you'll get a folowing look . Fading out can be disabled though.
UPDATE:
Non modal refactoring
In Silverlight there is a ChildWindow-Control that you can use as PopUp. The ChildWindow has properties to specify the Opacity and the Background of the Overlay, so that you can define if the Background screen is visible.
You can use the ChildWindow control to do this.
And even you can handle the events of this popup window on the parent window.
Most recently, while at my mom's house, a phone call came in and the caller ID popped up in a banner on her TV (Comcast). I've seen a similar functionality when the McAfee brings up a virus warning. It was a translucent popup window with the company logo, message and a button or two.
I'd like to mimic this behavior (via C#). This will event driven. My experience in C# is pretty limited, so I'm still feeling out the different libraries. Are there any ideas on where I should start?
I recommended to use WPF. Create new window, that will popup and set next properties:
WindowStyle="None"
AllowsTransparency="True"
Opacity="0.5" //50% transparent
Topmost="True"
Background property will set color of window.
Place on window any controls what you need.
Create this window and show when some event happens:
YourWindow popup = new YourWindow(/*possible args for message on popup, for example*/);
popup.Show();
To place your window in bottom-right corner, as all popups, use next code in windows Loaded event:
this.Left = SystemParameters.WorkArea.Width - this.Width;
this.Top = SystemParameters.WorkArea.Height - this.Height;
How to make animation of window movement you can read in other questions.
If your app is running in the background, you can simply pop up a window and set it to topmost.
Exactly what you do beyond that is going to depend on what type of UI are using (WPF/WinForms.) WPF makes it easier to build a transparent form, as described here:
http://blogs.interknowlogy.com/2007/06/20/transparent-windows-in-wpf-2/
Transparency in WinForms is a little bit harder, but there are some posts about it:
Partial transparency with C# .NET 3.5 WinForms?
A couple of things you will want to do with your pop-up window:
Disable the minimize/maximize/close buttons
Disable the borders
Just put those in your form so it looks better.
-- Dan
I am creating a GUI with C#. I intended to use a ListView to see preview of pictures, and a PictureBox to display the full view. I used a Panel as parent and placed a PictureBox inside of that to have scrollbars appear on the picture box.
What I still can't figure out how to do is to provide close, maximize, and minimize, buttons on the Panel, as seen in many GUI applications.
How can I do this? Any ideas will be appreciated.
Those other GUI applications probably use a Form instead of a Panel/PictureBox, assuming that they provide maximize, minimize, and close buttons.
You could add your own buttons to the Panel control, and then write code in their Click event handlers to do whatever you want with the control. This is easy and relatively straight-forward if you just want to be able to close the picture, but it seems like unnecessary work to duplicate all of the functions that are built right into a Form.
I'd ditch the Panel control, add a new Form to my project, place the existing PictureBox control onto the form that I just added, and go from there. You might want to set the form's FormBorderStyle property to something like "SizableToolWindow", depending on how you want it to look.