
Set Left and Width simultaneously?
Quote:
> I'm creating a control that allows itself to be resized by
> stretching out any corner. When the upper-left corner is
> stretched, it does the following:
> This.Left = This.Left + (X - m_AnchorX)
> This.Width = This.Width - (X - m_AnchorX)
> And it similarly updates the top and height. The problem
> is that the window is being painted between these two
> lines of code, producing a funky flicker effect. Is there
> any way to set both at once?
Use the Move method rather than set the individual properties (Height, Left,
Top, and Width) . As a rule of thumb, it's almost always better to use the
Move method than it is to set these 4 properties. Namely because the Move
method "sets" all 4 of these properties at once so you won't have the
problem you're encountering.
Quote:
> Is there a way to turn off painting for a moment? Without
> making the control invisible and then visible again (since
> that also flickers).
You can call the LockWindowUpdate API function to prevent painting of any
window, but in this case, you shouldn't need to do that if you use the Move
method.
Mike