1) Bring up ClassWizard 2) Select the "Message Maps" tab 3) In the "Object IDs" listbox, select the ID of the button you want to map 4) In the "Messages" list box, you should see BN_CLICKED, and BN_DOUBLECLICKED. 5) Doubleclick the BN_CLICKED entry. This will build a handler method within your class to handle the button click for your button.
求各位帮帮忙
图片按钮可以用CBitmapButton
楼主的要求只有自己编了。图片控件,响应dbclick
2) Select the "Message Maps" tab
3) In the "Object IDs" listbox, select the ID of
the button you want to map
4) In the "Messages" list box, you should see
BN_CLICKED, and BN_DOUBLECLICKED.
5) Doubleclick the BN_CLICKED entry. This will
build a handler method within your class to
handle the button click for your button.
一是:如何把已有图片加载到CBitmapButton
二是:CBitmapButton如何定义
谢谢!在线等,搞定就结贴.
倒入1个位图文件,在复制一下, ID设置为"BMPU"和"BMPD"一定要加双引号,倒入的位图文件名为bmp1.bmp
BMPU为按钮松开状态,BMPD为按下状态,BMPU为必须的
声明CBitmapButton m_Button1;
映射WM_INITDIALOG消息,并在其中加入代码
bmp1.AutoLoad(IDC_BUTTON1,this);
刚才错了
然后m_bmp1.AutoLoad(IDC_BUTTON1,this);
按钮的属性要设置owner draw
按钮的名字要和位图资源名字匹配
现在还有点问题:
1、“ID设置为"BMPU"和"BMPD"一定要加双引号,倒入的位图文件名为bmp1.bmp”。现在有两个位图,ID各为:"BMPU"和"BMPD",可两个位图的文件名是不能一样的呀,我各定义为:bmp1.bmp,bmp2.bmp。
2、“BMPU为按钮松开状态,BMPD为按下状态,BMPU为必须的”。这是如何与按钮相关的?
3、“声明为CBitmapButton m_bmp1;(后边的为图像的名字),然后m_bmp1.AutoLoad(IDC_BUTTON1,this);”。这样可以与按钮关联上吗?还有就是这段声明应该在MYCLASS::OnInitDialog()里声明?
谢谢您的回复!
后边的U表示松开,D表示按下,
这段声明最好是在初始化的时候使用
我用Radio Button结合Picture控件解决了