views:

21

answers:

2

Hi,

Is it possible to perform a specific action after the resize event (of the user control), for example when mouse button is released? I need to manually resize an inner control and doing it on every single firing of the event would be quite, hmm, inefficient...

+1  A: 

Just use the ResizeEnd event:

private void Form1_ResizeEnd(object sender, EventArgs e)
{
   // Your code here
}

From MSDN:

The ResizeEnd event is raised when the user finishes resizing a form, typically by dragging one of the borders or the sizing grip located on the lower-right corner of the form, and then releasing it. For more information about the resizing operation.

GenericTypeTea
Very tempting and I'd probably have already used it, but it's happening in the user control (I forgot to specify that, sorry) and I don't have access to the form's events.
brovar
@brovar: That's baloney! Every control has a `ParentForm` property. So in fact you have all that accessible!
leppie
@Why can you not just add a `ResizeMeNow()` method to the user control and call it on the Form's `ResizeEnd` event?
GenericTypeTea
@brovar - or like leppie has said, you can just hook into UserControl.ParentForm.ResizeEnd+= ... etc.
GenericTypeTea
Yes, I do have ParentForm, but it's not accessible after Handles and AddHandler is not something very welcomed in this application's code. (yep, VB.NET, not c#)
brovar
Ok, ResizeEnd it is, thanks for help ;)
brovar
A: 

Maybe you can use the SizeChanged Event. But i don´t know how often or when it´s called during resizing.

Jehof
Just like Resize, time after time.
brovar