Scene:
1. CStatic supports an indefinite length of string, can also support the picture background, and of course the parent control responds to the wm_ctlcolorstatic message.
2. CStatic that can respond to a click event can be used as a simple button without the need for custom drawing operations.
3. Normal created cstatic can not respond to click Time, need to add ss_notify style, note that Aa_static_click is a custom event ID.
#ifndef __dh_static#define __dh_static#include "Window/common/dh_win_message.h" class Dhstatic:public CWindowImpl <DHSTATIC,CSTATIC>{PUBLIC:BEGIN_MSG_MAP_EX (dhstatic) message_handler (Wm_lbuttondown,onlbuttondown) DEFAULT _reflection_handler () End_msg_map () Public:protected:LRESULT OnLButtonDown (UINT umsg, WPARAM WPARAM, LPARAM LPARAM, bool& bhandled) {:: SendMessage (GetParent (), Aa_static_click, (WPARAM) GetMenu (), NULL); return 0;}; #endif
How to use:
Statement:
BEGIN_MSG_MAP_EX (dhtoolbardelegate) message_handler (aa_static_click,onconnectdevice) COMMAND_ID_HANDLER ( Ktoolbarregisterbuttonid,onregister) End_msg_map ()
Create:
Connect_phone_. Create (Parent_,cpr,default_name_.c_str (), ws_visible | Ws_child | Ss_notify,0,ktoolbarconnecttextid); Connect_phone_. SetFont (Apputil::getfont (16,true,l "Arial"));
[atl/wtl]_[primary]_[forwarding message let cstatic support click Message Operation]