When I maximize 1 MDI child form, all MDI child forms would be maximized too. Is it possible to have 1 form maximized and another one not?
Thanks in advance.
A maximized MDI child form should occupy the entire child area and so the state of the other children should not really matter as they are not visible.
If you want to see a maximized window with another smaller window in front of it, I think some kind of user interface with docking and floating panels would be a better choice. Something like the way it works in Visual Studio.
Creating custom MDI/Non-MDI functionality is very time consuming and frustrating work, and the end result can be confusing to users who are used to standard MDI.
Not possible. Only thing you can do is to set the window in front non MDI and taskbar = no
Yes, you CAN do this - use the API Call SetParent instead of setting .MDIParent.
The Maximized Form will need to be an MDI Child called with Child1.Show().
The non-Maximized Form will need to NOT be an MDI Child called with Form1.Show(this) or Form1.ShowDialog(this).
Related
When I set the main window's visibility to hidden, No icon is shown in taskbar, so I have no control over the window to show it again. I want for the application's icon to be visible even when I hide the window, and to show the window when I click it's button in the taskbar. (something like minimize behavior)
How can I achieve that using WPF and .Net 4.0 in C#?
Edit: I mean the icon in taskbar (usually in the left and middle of the horizontal taskbar) not the notifyicon in system tray.
So, based on "comments" section, what you are looking to do is minimize or hide a window but still show some windows or dialogues that the window opens. First if you want to keep your window in the task bar, you should minimize with:
this.WindowState = WindowState.Minimized
That can be called from anywhere within the form. As you mentioned, though, this will close hide any dialogues that have this window set as the parent. The key, then is to not use this window as the parent. Lets say your dialogues inherit from form. You want to use:
newWindow.Show();
I am guessing that you are calling "ShowDialog", which ties the window state to the parent window state. Try this out and hopefully it will help!
Edit
One more note: the same is actually true of MessageBoxes, but the way to control the parent form is with the first parameter of the MessageBox.Show() call. If you pass in a form as the first parameter, that will be the parent, otherwise the parent will not be set.
I have been working on a windows form application based in c# and I am in need of some assistance. I am trying to recreate the window flicker that most windows applications have when a form loses focus to a parent form. Best way I can explain this is open up calculator open the help window and try to click the calculator, the help window then without falling behind the calculator flickers losing and gaining the shadowing around the edges.
I have managed to regain the focus on the child window when the parent is clicked but this creates a odd flickering effect as the parent window is momentarily brought in front of the child window. I am only guessing but that effect I am looking for appears to be that the calculator is never brought in front of the help window and then the help window is simply activated and deactivated a few times.
I tried doing some searches and I have seen a few topics relating to this but none of the solutions quite match. I am fairly new to making windows form applications so there are still a things I don't understand so be patient with me if I don't understand something at first.
Thank you in advance
An elaboration on the calculator example:
1) open up calculator from windows accessories
2) in the toolbar go to the help tab and open the about calculator option
3) click on the calculator window
4) the about calculator window will then flicker while never falling behind the calculator
The only progress I have made towards this is
private void MainForm_Activated(object sender, EventArgs e)
{
if (Open == true)
{
//blink active window
_addForm.Activate(); //makes window active
}
}
The open variable is something I use to keep track of if open forms and is made true when I show another form.
In your example the About window is called a modal window. A modal window prevents the user from interacting with the parent window until it is closed. Use Form.ShowDialog instead of Form.Show to present a Form to the user as a modal window.
Make the child form modal. This means that the child must be closed properly before focus can be transferred back to the parent.
I am opening a form in a mdi parent. I show the form in the parent and the window state of the new form in the designer is maximized. For some reason, the form appears in the top left corner of the mdi parent, and the control box is way over to the right as if it was maximized, but the size of the window is not filling up the screen. So the behavior is as if it were maximized, but it is not filling the screen. What should I do?
I'm using C#.Net Winform.
Set your child form's window state to maximized.
This will maximize your form.
childForm.WindowState = FormWindowState.Maximized;
You can do this on load of your MdiParent form, or whenever you open show this child form.
Make sure your MdiChilds MaximumSize Property is not set. If it is it will look like this, which looks like what you have described in your question.
Coming in late, but I too am having this problem and so far nobody's answered why it's happening. I found this discussion on MSDN that explains more of what is really a workaround suggested by #nunespascal:
Basically I can't set WindowState to Maximised in the Designer, but if I leave it set to Normal and then when loading the form in code I set it to Maximised it works.
This is also the answer provided in this StackOverflow post.
Is it possible for the entire bounds of a form to be hittest transparent without adjusting the visibility of the form?
I am using a user32 api call to WindowFromPoint in order to find the control under the mouse. In some circumstances I would like to ignore the existance of a child form that floats in front of the main form (or another child form), but keep this form to ignore visible.
Setting the Opacity of the form to ignore to 0 will successfully cause the hittest to pass straight through it, but the form obviously is invisible, and I'd prefer it to remain visible.
Since this child form can have any arbitrary number of controls on it, is there a way for this form intercept all WM_NCHITTEST messages going to child controls on the form so that I can return hittest transparency for each control? The controls contained on the form are arbitrary so I am unable to modify them internally.
You are looking for the WS_EX_TRANSPARENT Windows Style.
This answer gives a good-enough explanation.
I have an application with a main form that acts as a sort of frame and an area inside the main form where I open other forms. These forms must not be closed ever so when a new one is opened I use this code to open it for the first time:
frm.WindowState = FormWindowState.Maximized;
frm.BringToFront();
And then if another form gets opened on top of that and I need to show it again I just use:
frm.Show();
The problem is when I open the form the first time its positioned perfectly and the borders line up nice. When I use frm.Show() to bring it back it moves it slightly to the left and down. Any clue why?
You should set the StartPosition property to 'manual' in form properties window
or
frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
From your explanations, I understand you're using a parent form to contain MDI child forms (correct me if I'm wrong)
When a new MDI child form is shown, it is placed so that child forms are in "cascade", i.e. each child form is at the same position of the previous one plus an offset. When you hide a child form and show it again, the MDI container probably considers that it's a new child form, and it places accordingly...
I think you need to save the location of the child form before you hide it, so that you can restore it when you show it again