Lieven Cardoen
Lieven Cardoen

Reputation: 25959

How to not constantly resizing a control docked in a Windows Form?

Is there a way to not constantly resize a Control that is fully docked in a Windows Form?

The resizing of our control takes a lot of cpu, so we would either want to resize only if the user hasn't dragged for let's say a second or when he has stopped resizing (mouse up).

Is there some built-in functionality in Windows Forms to do this?

Upvotes: 1

Views: 68

Answers (1)

tezzo
tezzo

Reputation: 11105

Try to suspend control drawing on form ResizeBegin and resume drawing on form ResizeEnd.

To suspend drawing:

SendMessage(ctrlControl.Handle, WM_SETREDRAW, 0, 0)

To resume drawing:

SendMessage(ctrlControl.Handle, WM_SETREDRAW, 1, 0)
ctrlControl.Refresh()

Upvotes: 1

Related Questions