[atl/wtl]_[primary]_[forwarding message let cstatic support click Message Operation]

Source: Internet
Author: User


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]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.