Sign in to follow this  

[.net] form resize

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just did a test with a RichTextBox with the Dock member set to Fill and Resize event is called when it grows and shrinks.

I think we need more information about what you are doing and how you are doing it.

theTroll

Share this post


Link to post
Share on other sites
A quick look in the .Net documentation reveals this for UserControl.OnResize:
Quote:

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

which means it's behaviour is undefined. What you need to use is the OnSizeChanged event.

Skizz

Share this post


Link to post
Share on other sites
Quote:
Original post by Skizz
A quick look in the .Net documentation reveals this for UserControl.OnResize:
Quote:

This method supports the .NET Framework infrastructure and is not intended to be used directly from your code.

which means it's behaviour is undefined. What you need to use is the OnSizeChanged event.

Skizz


To go along with this. Many people override On_____ functions instead of subscribing to an event. Overriding a built in function should only be done if you don't want the base behavior done at all. If you just want to add functionality, the just subscribe to the event and add your own function.

theTroll

Share this post


Link to post
Share on other sites
Thanks for the replies. I switched to event handling, but it still wasn't working. I tested and was getting resize events when I shrunk down. What seems to have happened was that when I resize up, it will also invoke my paint handler, but when I resize down, it doesn't (but I want it to). So I just added an Invalidate in the resize handler and now it works as expected.

Share this post


Link to post
Share on other sites

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this