Detecting transition from FormWindowState 'Minimized to another state

  • Thread starter Thread starter Bill Woodruff
  • Start date Start date
B

Bill Woodruff

Hi,

Right now I am implementing the WinForm's 'LocationChanged event, and
setting a flag if the WindowState is Minimized.

Then, in the same Event Handler, I can determine ... if the WindowState has
changed to Maximize or Normal ... from the flag, whether I am in a
transition from the Minimized state, do what I need to do (with secondary
forms [not children of the Main App Form] that I have made persist [stay on
the screen] when the Main App FormWindow is Minimized), then reset the flag.

But this all seems kind of "inelegant" : I keep thinking there should be
"native" Event like "FormWindowStateChanged" or such.

Just curious if anyone has used an alternative technique for this.

thanks ! Bill Woodruff
dotScience
Chiang Mai, Thailand

"Outside of a dog, a book is a man's best friend : inside of a dog, it's too
dark to read."

Groucho Marx
 
Bill Woodruff said:
Right now I am implementing the WinForm's 'LocationChanged event, and
setting a flag if the WindowState is Minimized.

Override your form's 'WndProc' and listen for 'WM_SYSCOMMAND'. The 'wParam'
parameter will contain 'SC_MINIMIZE' if the form is about to be minimized.
 
Back
Top