OnResize and OnSizeChanged

  • Thread starter Thread starter Rajeev Soni
  • Start date Start date
R

Rajeev Soni

Hi,

What is the differnce between OnResize and OnSizeChanged events in windows forms.

Thanks
Rajeev
 
Thanks for the info.

Rajeev.
Internally, OnSizeChanged calls OnResize so they are pretty tightly linked.

The OnResize method is responsible for invalidating the control if the ResizeRedraw style is set.

Hope this helps.

--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

New Tips and Tricks include creating transparent controls
and how to do double buffering.

Hi,

What is the differnce between OnResize and OnSizeChanged events in windows forms.

Thanks
Rajeev
 
Rajeev,
My understanding is:

OnResize occurs when the window receives a WM_RESIZE message from Win32.

OnSizeChanged occurs when the Size property changed.

As Rob stated, OnSizeChanged calls OnResize, also somehow when OnResize
occurs the Size property itself changes...

Also realize that OnResize will cause OnLayout to be called outside of
matching calls of the SuspendLayout and ResumeLayout functions.

I normally use OnLayout to change the layout of controls in respond to a
sizing event. As OnLayout is protected by the SuspendLayout & ResumeLayout
functions.

Hope this helps
Jay

Hi,

What is the differnce between OnResize and OnSizeChanged events in windows
forms.

Thanks
Rajeev
 
Back
Top