2

I am developing an application in C#. I have a Main Form where I have some buttons that give the user the possibility to start a new form into the Main Form.

When there are more of this kind of forms opened and the user choose to minimize one, it goes to back behind all opened forms. So if the user would want to open again that form he must close/minimise all forms.(for beeing able to see the minimized one)

How can I manage the minimised form location so it could be visible after it is minimised? I tried without any result stuff like that: bringToFront, Activate, Focus, etc.

My Main Form contains the buttons and a panel, so the forms are opening in the panel bellow the buttons.

enter image description here

Community
  • 1
  • 1
Emil Condrea
  • 9,705
  • 7
  • 33
  • 52
  • I'm not sure there is a way, you are dealing with two mutually exclusive states. When a form is minimized, it's not visible. Are you saying you want to set the location of the form when it is moved from minimized to unminimized? – casperOne Jul 21 '11 at 12:07
  • Can you post some sample screenshots. My first thought is you have to handle how the form that the user opens. What exactly do you mean "start a new form into the main form" do you mean within? – Security Hound Jul 21 '11 at 12:17
  • Is your main form setup as an mdi form? Are you tracking the forms that you open in something like a Window menu? If the form is minimize and you want to bring it to the front, you have to first set it to Normal or Maximized and then bring it to the front. – Alex Mendez Jul 21 '11 at 12:19
  • @RamHound i posted a screenshot – Emil Condrea Jul 21 '11 at 12:34
  • I've seen this, it is behavior that's triggered by a bug in your code. Not sure what causes it but it has something to do with the code preventing the form window from getting hidden when it gets minimized. Anyhoo, the proper way is to ensure that the ShowInTaskbar property of the form is set to True so that the user can always go back to the form with the taskbar button. Don't try to take advantage of the bug, that can't go anywhere. – Hans Passant Jul 21 '11 at 13:05
  • In the screenshot I made at point "1" I dragged a little bit the main form so the minimised one to be visible. If I wouldn't drag it would not be visible. But I want it to be visible after minimizing – Emil Condrea Jul 21 '11 at 13:12

3 Answers3

2

why don't you go for MDI win-form ? I think they fit really well in what you are trying to achieve

http://msdn.microsoft.com/en-us/library/ms973874.aspx

Massimiliano Peluso
  • 26,379
  • 6
  • 61
  • 70
  • i tried with MDI win-form, but it's the same result. Take a look at the screenshot I made, maybe you understand better what I try to do – Emil Condrea Jul 21 '11 at 12:48
0

I know this is late post but might be useful for someone like me. Try this this was working for me to set minimized window location and size as well


https://social.msdn.microsoft.com/Forums/windows/en-US/d6014e48-2adb-4096-8bea-94c2f3b1c47c/how-to-change-the-location-of-a-minimized-mdichild-form?forum=winforms
Just J
  • 23
  • 4
0

Finally I did managed myself to solve the problem. It was so simple.

For the forms that opens in the panel child I removed

formName.Dock = DockStyle.Fill;

and I set the formName.Height = panelContainer-25; So now the little form minimized is visible.

Emil Condrea
  • 9,705
  • 7
  • 33
  • 52