HOWTO: Use the DeferWindowPos Family of Functions
ID: Q87345
|
The information in this article applies to:
-
Microsoft Windows Software Development Kit (SDK)
-
Microsoft Win32 Software Development Kit (SDK)
-
Microsoft Windows 2000
SUMMARY
In the Microsoft Windows graphical environment, an application can use
the BeginDeferWindowPos, DeferWindowPos, and EndDeferWindowPos
functions when it moves or sizes a set of windows simultaneously.
Using these functions avoids unnecessary screen painting, which would
occur if the windows were moved individually.
The eighth parameter to the DeferWindowPos function can be any one of
eight flag values that affect the size and position of each moved or
sized window. One of the flags, SWP_NOREDRAW, disables repainting and
prevents Windows from displaying any changes to the screen. This flag
effects both the client and nonclient areas of the window. Any portion
of its parent window uncovered by the move or size operation must be
explicitly invalidated and redrawn.
If the moved or sized windows are child windows or pop-up windows,
then the SWP_NOREDRAW flag has the expected effect. However, if the
window is an edit control, a combo box control, or a list box control,
then specifying SWP_NOREDRAW has no effect; the control is drawn at
its new location and its previous location is not erased. This
behavior is caused by the manner in which these three control classes
are painted. Buttons and static controls function normally.
To work around this limitation and move a group of edit, list box, and
combo box controls in a visually pleasing manner, perform the
following three steps:
- Use the ShowWindow function to hide all of the controls.
- Move or size the controls as required with the MoveWindow and
SetWindowPos functions.
- Use the ShowWindow function to display all of the controls.
Additional query words:
combobox listbox
Keywords : kbNTOS kbWinOS2000 kbSDKWin32 kbGrpUser kbWinOS kbWndw
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbhowto