I’m working with some real-time drawing on a sizable form. When the user resizes the form, I do not want to apply size change to my graphics rendering until the user has released the mouse button, thus resizing is finished. How do I detect this and only resize my rendering once the user has finished resizing the form? Because right now, if I use the OnResize event of my form, it will constantly re-render everything for every pixel the mouse has moved.
I have tried the mouse down/up events and tracking this, but these events aren’t called when the form is being resized.
To detect the moving or sizing has started, catch the
WM_ENTERSIZEMOVEmessage. It’s being sent to a window once the user clicks the window’s title bar or sizing border (what makes the window enter the moving or sizing loop).To detect the moving or sizing has finished, catch the
WM_EXITSIZEMOVEmessage. It’s being sent to a window once the user release the window’s title bar or sizing border (what makes the window exit the moving or sizing loop).You can catch either of them by declaring (and implementing) them at the form level: