DrawFrameControl function
Applies to: desktop apps only
The DrawFrameControl function draws a frame control of the specified type and style.
Syntax
BOOL DrawFrameControl( __in HDC hdc, __in LPRECT lprc, __in UINT uType, __in UINT uState );
Parameters
- hdc [in]
-
A handle to the device context of the window in which to draw the control.
- lprc [in]
-
A pointer to a RECT structure that contains the logical coordinates of the bounding rectangle for frame control.
- uType [in]
-
The type of frame control to draw. This parameter can be one of the following values.
Value Meaning - DFC_BUTTON
Standard button
- DFC_CAPTION
Title bar
- DFC_MENU
Menu bar
- DFC_POPUPMENU
Popup menu item.
- DFC_SCROLL
Scroll bar
- uState [in]
-
The initial state of the frame control. If uType is DFC_BUTTON, uState can be one of the following values.
If uType is DFC_CAPTION, uState can be one of the following values.
Value Meaning - DFCS_CAPTIONCLOSE
Close button
- DFCS_CAPTIONHELP
Help button
- DFCS_CAPTIONMAX
Maximize button
- DFCS_CAPTIONMIN
Minimize button
- DFCS_CAPTIONRESTORE
Restore button
If uType is DFC_MENU, uState can be one of the following values.
If uType is DFC_SCROLL, uState can be one of the following values.
The following style can be used to adjust the bounding rectangle of the push button.
Value Meaning - DFCS_ADJUSTRECT
Bounding rectangle is adjusted to exclude the surrounding edge of the push button.
One or more of the following values can be used to set the state of the control to be drawn.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
If uType is either DFC_MENU or DFC_BUTTON and uState is not DFCS_BUTTONPUSH, the frame control is a black-on-white mask (that is, a black frame control on a white background). In such cases, the application must pass a handle to a bitmap memory device control. The application can then use the associated bitmap as the hbmMask parameter to the MaskBlt function, or it can use the device context as a parameter to the BitBlt function using ROPs such as SRCAND and SRCINVERT.
Requirements
|
Minimum supported client | Windows 2000 Professional |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
Send comments about this topic to Microsoft
Build date: 3/7/2012
somehow the DrawFrameControl call takes more than 250 ms on Windows 7,
while on Windows XP the call takes less then 1 ms
as with its old-style graphics it does not do many things and so it should not take any time on a modern PC
so it looks like there is an artificial delay placed in the call in Windows 7
I've made a small presentation on this subject: http://www.youtube.com/watch?v=07hjIJygrOA
ANSWER: ... or probable answer ... The issue may be due to the DrawFrameControl API internally using old API calls that are penalized in Vista / 7 due to the Desktop Window Manager (DWM). The DWM "double buffers" the top-window (but not children) in the graphic card, and the GPU renders the window to the screen. But few operations, and I am suspecting some bit-blt'ing in the above API does this, may need to read video memory contents directly from the video buffer. This apparently is very expensive, since it uses hardware busses that are not oprimized for transfer (graphic cards are optimized for sending data to them, not the other way) and it also trashes the GPU cache. There are few blogs on the topic, among other this one: http://blogs.msdn.com/b/kamvedbrat/archive/2006/04/02/566788.aspx. Try to disable Aero. Alternatively do the drawing on a memory DC.
- 1/6/2012
- ArnoudMulder
- 1/9/2012
- todort
// undocumented DrawFrameControl styles
#define DFCS_MENUARROWUP 0x0008 /* scroll menu up */
#define DFCS_MENUARROWDOWN 0x0010 /* scroll menu down */
#define DFCS_INMENU 0x0040 /* modifier for DFC_MENU as captionbtn drawn in systemmenu */
#define DFCS_INSMALL 0x0080 /* modifier for DFC_MENU as captionbtn for WS_EX_TOOLWINDOW */
UPDATE: I've found the DFCS_INxxx constants at http://www.reactos.org/wiki/Techwiki:Win32k/SERVERINFO
but I can't see any differences in drawing of the buttons so prob' haven't got any meaning in Windows.
The buttons are drawn by vectors so to draw a "menu" close icon simply draw a DFCS_CAPTIONCLOSE button with the size of SM_CXMENUCHECK/SM_CYMENUCHECK.
- 1/5/2012
- ArnoudMulder
- 1/6/2012
- ArnoudMulder
it is never updated to use the theme api introduced with XP...
use theme api for the modern look-and-feel
- 1/5/2012
- ArnoudMulder
- 1/5/2012
- ArnoudMulder
i.e. to draw the menu symbols in the system menu:
DFCS_CAPTIONCLOSE
DFCS_CAPTIONRESTORE
DFCS_CAPTIONMAX
DFCS_CAPTIONMIN
- 1/2/2012
- ArnoudMulder