用win32 api(非mfc)实现的一个圆..
时间:2010-10-12 来源:chenchao40322
WM_COMMAND Notification
The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.
这个消息会在3中情况发送给控件的父窗口:
1:当用户从菜单中选择了一项。
2:子控件发送被父窗口(比如按钮点击)
3:用户使用了加速键。
WM_SYSCOMMAND Notification
A window receives this message when the user chooses a command from the Window menu (formerly known as the system or control menu) or when the user chooses the maximize button, minimize button, restore button, or close button.
当用户点击了系统菜单或者点击了最大化、最小化、移动、还原等按钮时发送给窗口本身的。
WM_DRAWITEM Notification
The WM_DRAWITEM message is sent to the parent window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.
当自会控件需要重绘的时候,就会给它的父窗口发送这个消息。
WM_PAINT
The WM_PAINT message is sent when the system or another application makes a request to paint a portion of an application's window.
当控件需要重绘的时候,窗口本身会收到这个消息。
所以要实现按钮自绘以及处理相应按钮事件,有两种方法.
1:在父窗口窗口函数中处理WM_DRAWITEM消息,实现绘制;
在父窗口窗口函数中处理WM_COMMAND消息,实现button消息处理;
2:在按钮本身窗口函数中处理WM_PAINT消息,实现绘制;
在按钮本身窗口函数中处理WM_LBUTTONDOWN、WM_LBUTTONUP等消息,实现button消息处理;
下面是个例子: