Author: Jonas Bilinkevicius
Has anyone found a way to prevent the Paint method from firing when you're in the
middle of resizing a form? In other words, is there some way to ghost the change
until the user actually releases the mouse button, instead of redrawing the form
constantly during the resize?
Answer:
You can revert to the way a window was resized in Win 3.1 - with a sizing frame and
a redraw only when the user let go of the mouse.
In your forms declaration you place this:
1 private2 {Private declarations}3 FDragFullWindowState: LongBool;
4 procedure WMEnterSizeMove(var msg: TMessage); message WM_ENTERSIZEMOVE;
5 procedure WMExitSizeMove(var msg: TMessage); message WM_EXITSIZEMOVE;
6 7 The implementationis like this:
8 9 procedure TProdBuilderMainForm.WMEnterSizeMove(var msg: TMessage);
10 begin11 SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, @FDragFullWindowState, 0);
12 if FDragFullWindowState then13 SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, Ord(False), nil, 0);
14 end;
15 16 procedure TProdBuilderMainForm.WMExitSizeMove(var msg: TMessage);
17 begin18 if FDragFullWindowState then19 SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, Ord(True), nil, 0);
20 end;