How to override form's Maximize button operation?
From: Dave Leach (babel_at_newsgroup.nospam)
Date: 03/03/05
- Next message: Guest: "Re: Can't instantiate MODI MiDocViewer"
- Previous message: Ryan Taylor: "Fixed Dialog without a title bar"
- Next in thread: Jeffrey Tan[MSFT]: "RE: How to override form's Maximize button operation?"
- Reply: Jeffrey Tan[MSFT]: "RE: How to override form's Maximize button operation?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 3 Mar 2005 11:25:09 -0800
I am developing a Windows Forms application in VS.NET 2003 and C#. The
application is using the MDI style. I have one or more child forms visible
in the client area of the main form.
I want to keep the MaximizeBox property set to True so that the user can
click the maximize button on the title bar. However, I want to catch this
event and perform my own version of a maximize operation. I have tried
catching the SW_MAXIMIZE message in the child form's WndProc and call my own
max function, but it still does the normal maximize operation. See sample
code below.
How can I override this message or event?
Thanks,
Dave
######## Code #######
protected override void WndProc( ref Message m )
{
if ( m.Msg == User32DllImports.SW_MAXIMIZE )
{
Debug.WriteLine( "SW_MAXIMIZE message." );
this.Zoom( mdiParent.UsableClientAreaSize() );
return;
}
}
###################
- Next message: Guest: "Re: Can't instantiate MODI MiDocViewer"
- Previous message: Ryan Taylor: "Fixed Dialog without a title bar"
- Next in thread: Jeffrey Tan[MSFT]: "RE: How to override form's Maximize button operation?"
- Reply: Jeffrey Tan[MSFT]: "RE: How to override form's Maximize button operation?"
- Messages sorted by: [ date ] [ thread ]