Detecting end of re-sizing event?

W

What-a-Tool

Have code that is called by my form re-size event. While the form borders
are being dragged back and forth, this code will run continuosly, when it
really only needs to run at the end of the re-size event.

Someone on the Windowsforms group suggested testing in the re-size event to
see if the mouse button is down - when it is released run the code. (at
least that is how I understood it).
I can't figure out how to detect mouse events which occur on the forms
borders, however. (Nor from within a re-size event, which is over when the
mouse is released, anyway)

Can anyone suggest a method for running my code at the end of a re-size? (or
when my mouse is released at the end of a re-size?)

Thanks

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
W

What-a-Tool

Was given the following on WindowsForms -

Hi,

I meant WM_ and WM_NC messages, which allow to intercept mouse or sizing
related events for non-client areas of windows. Border is not in client area
unfortunately. You have to check Platform SDK for all the details if you
want to know more. In your program you need to override WndProc and to be
able to intercept these messages. In particular you might be able to do what
you want with WM_NCCALCSIZE and WM_NCHITTEST.

If you have thick border you can also intercept WM_GETMINMAXINFO and
WM_WINDOWPOSCHANGED. But you have to check docs to find out what would be
best in your case.

Use these procedures in your form to understand sequence of messages and how
to deal with situation:

[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

protected override void WndProc(ref Message m)

{

Console.WriteLine(m.Msg.ToString());

base.WndProc(ref m);

}


[System.Security.Permissions.PermissionSet(System.Security.Permissions.Secur
ityAction.Demand, Name="FullTrust")]

public override bool PreProcessMessage(ref Message msg) {

Console.WriteLine(msg.Msg.ToString());

return base.PreProcessMessage(ref msg);

}


I hope you can easily translate it to VB. These will print all messages,
which you get for NC and client areas as they appear.


HTH
Alex


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 

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