WM_SYSCOMMAND seems to work, and this doesn't require unsafe code.
(Although it still requires overriding of WndProc, which I don't like...
But I don't see how you can avoid that here.)
protected override void WndProc(ref System.Windows.Forms.Message m) {
// WM_SYSCOMMAND
if (m.Msg == 0x112) {
int sc = m.WParam.ToInt32() & 0xfff0;
// SC_MOVE and SC_SIZE
if (sc == 0xF010 || sc == 0xF000) {
m.Result = new IntPtr(0);
return;
}
}
base.WndProc(ref m);
}
I think this is simpler than Rama Krishna's version - his will work (and you
should avoid the flickering on resize if you catch all of the messages he
suggests). But this seems to do everything in one go for me.
--
Ian Griffiths
DevelopMentor
----- Original Message -----
From: "John Daintree" <[EMAIL PROTECTED]>
> You might want to look at WM_SYSCOMMAND with a SC_MOVE or SC_SIZE in
wParam.
> Also take a look at WM_WINDOWPOSCHANGING.
>
>
> ----- Original Message -----
> From: "Rama Krishna" <[EMAIL PROTECTED]>
>
> > In order to fix resize flicker handle other WM_NCHITTEST cases like
> > HTBORDER, HTSIZE. This would not allow the resize.
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.