2
votes

I have a .Net 4 WinForms application with the following properties on my MainForm:

  • FormBorderStyle = None
  • WindowState = Maximized

It works as expected and covers the entire screen. However, if a second monitor is disconnected while the application is open, the screen goes black while Windows is "removing" it, and then when the screen comes back, the application is resized so that it fits above the taskbar. I want the application to always be fullscreen and on top. Ideas?

1
I'm guessing that the application is losing focus. Explorer is probably getting focus. You could try setting your window as topmost.David Crowell
What happens if your winforms app is on the second monitor when it is disconnected?Paul Zahra
Have you tried setting TopMost = true ? See msdn.microsoft.com/en-us/library/…Paul Zahra
Setting the TopMost property to true does not help, unfortunately.JLe

1 Answers

0
votes

Maybe you should WindowState = Maximized in the onFocus event of your MainForm.