On Wed, 07 Apr 2004 17:11:39 +0530, Jim wrote:
I intend to set the form Visibility to false and show a taskbar icon
instead. I've done this on the FormClosing event but I want this to
happen when the form is minized too.
declare the following somewhere in your form:
public event EventHandler Minimize;
and inside the constructor of your form, attach an event handler:
this.Minimize += new EventHandler(this.Form1_Minimize);
and finally, copy/paste this method to your form:
protected override void WndProc(ref Message msg) {
const int WM_SIZE = 0x0005;
const int SIZE_MINIMIZED = 1;
if ((msg.Msg == WM_SIZE) && ((int) msg.WParam == SIZE_MINIMIZED) &&
(this.Minimize != null)) {
this.Minimize(this, EventArgs.Empty);
}
base.WndProc(ref msg);
}
--
Asbjørn Ulsberg -=|=-
as******@hotmail.com
"He's a loathsome offensive brute, yet I can't look away"