RE: How to override form's Maximize button operation?
From: Jeffrey Tan[MSFT] (v-jetan_at_online.microsoft.com)
Date: 03/04/05
- Next message: Newbie: "Re: Error Message: Object reference not set to an instance of an o"
- Previous message: tsiGeorge: "MDI Client Problem"
- In reply to: Dave Leach: "How to override form's Maximize button operation?"
- Next in thread: Dave Leach: "RE: How to override form's Maximize button operation?"
- Reply: Dave Leach: "RE: How to override form's Maximize button operation?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 04 Mar 2005 05:33:23 GMT
Hi Dave,
Thanks for your posting!!
When a form's window is maximized, no SW_MAXIMIZE is sent to the WndProc,
instead, a WM_SYSCOMMAND message(whose wParam is SC_MAXIMIZE) is sent to
the Window procedure, so we may intercept and filter the maximize operation
with the code snippet below:
const int WM_SYSCOMMAND= 0x0112;
const int SC_MAXIMIZE= 0xF030;
protected override void WndProc(ref Message m)
{
if(m.Msg==WM_SYSCOMMAND)
{
if((int)m.WParam==SC_MAXIMIZE)
{
MessageBox.Show("Maximized!!");
return;
}
}
base.WndProc (ref m);
}
It works well on my side. Hope it helps
========================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
- Next message: Newbie: "Re: Error Message: Object reference not set to an instance of an o"
- Previous message: tsiGeorge: "MDI Client Problem"
- In reply to: Dave Leach: "How to override form's Maximize button operation?"
- Next in thread: Dave Leach: "RE: How to override form's Maximize button operation?"
- Reply: Dave Leach: "RE: How to override form's Maximize button operation?"
- Messages sorted by: [ date ] [ thread ]