please show how i can create custom button with win32 api and c++ . only win32 api , no mfc .
i saw sites . please explain .
Thanks.
How create custom button with Win32 API %26amp; C++ ( Not MFC ) ?
Create a button with style BS_OWNERDRAW. The BUTTON class then sends a WM_DRAWITEM to the parent window whenever it recieves a WM_PAINT message.
Simple Example:
case WM_DRAWITEM:
{
DRAWITEMSTRUCT* data=(DRAWITEMSTRUCT*)lParam;
if(data-%26gt;itemState %26amp; ODS_SELECTED)
DrawEdge(data-%26gt;hDC, %26amp;data-%26gt;rcItem, EDGE_SUNKEN, 0);
else
DrawEdge(data-%26gt;hDC, %26amp;data-%26gt;rcItem, EDGE_RAISED, 0);
return TRUE; //We handled this message
}
This draws a pressable blank button.
typedef struct tagDRAWITEMSTRUCT {
UINT CtlType;
UINT CtlID;
UINT itemID;
UINT itemAction;
UINT itemState;
HWND hwndItem;
HDC hDC;
RECT rcItem;
DWORD itemData;
} DRAWITEMSTRUCT;
Please see http://msdn.microsoft.com/library/defaul... for more information
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment