resizing a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to call some procedures after user resized the form.
Not while he is resizing it, but AFTER resizing is finished, i.e. user
released mouse button.
Any ideas how to do this?
Thank you
 
Hi,


Not sure if this is correct, but I bit it's

At the resiziing event set a flag , hook the mouse up event of the form then
check if the flag is set, if so do your procedures and remember to set off
the flag.


cheers,
 
Thank you Ignacio, but problem is that MouseUp/Down events are not fired when
you click on window's border.
 
You'll have to override the WndProc(ref Message m) method of the Form.
Once you do that, you'll have to look for the message that is sent for
a resize and kick off your methods. I'm not entirely sure what the
constant is for the window resize, but you should be able to find it
fairly easy by experimenting with debug statements and a little trial
and error.

Something like this might do:

bool _blnResizing = false;

protected override void OnResize(EventArgs e)
{
_blnResizing = true;
base.OnResize(e);
}

protected override void WndProc(ref Message m)
{
if(_blnResizing && m.Msg == 533)
{
//TODO: add your code here.
_blnResizing = false;
}
base.WndProc(ref m);
}


I'm not Exactly sure that 533 is the message number in question but I'm
*pretty* sure it's your machine saying you've performed a non-client
mouseup. You may get a better idea by scanning the Win32.h file on your
machine and looking at the names of the constants.

I hope that's helpful.

Ben Lesh
Author, SlickWin Forms Control Suite
Fully Customizable .NET Component Suite
http://www.slickcode.com/slickwin.aspx
 

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

Similar Threads


Back
Top