Detecting transition from FormWindowState 'Minimized to another state


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
 
Ad

Advertisements

H

Herfried K. Wagner [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top