初学者的问题!!关于位图按钮,请帮忙!

lanfanghelanfanghe 2003-07-20 10:23:02
在对话框放了一个按钮为IDC_BUTTON1

..Dlg类中加入了CBitmapButton m_button

然后画了一个位图ID为"COPYU",又画了一个为"COPYD"

在OnInitDialog()中加入了

VERIFY(m_button.AutoLoad(IDC_BUTTON1,this));

为什么执行时会出现异常?
...全文
20 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tiangua 2003-07-20
  • 打赏
  • 举报
回复
gz
lanfanghelanfanghe 2003-07-20
  • 打赏
  • 举报
回复
请大家帮帮忙呀,谢谢呀!!
lanfanghelanfanghe 2003-07-20
  • 打赏
  • 举报
回复
是加载位图的异常
lanfanghelanfanghe 2003-07-20
  • 打赏
  • 举报
回复
CBitmapButton的AutoLoad()函数是怎么识别位图资源的呀
liu_swallow 2003-07-20
  • 打赏
  • 举报
回复
什么异常呀!
xtuzi 2003-07-20
  • 打赏
  • 举报
回复
你可以这样做,用ClassWizard建立一个基于控件的CButton变量
CButton m_button;
然后把手动CButton改为CBitmapButton
其他的地方不需要如InitialDialog里不用AutoLoad
lanfanghelanfanghe 2003-07-20
  • 打赏
  • 举报
回复
我设置成了Owner Draw 了

我的m_button,就是一个CBitmapButton 变量呀
xtuzi 2003-07-20
  • 打赏
  • 举报
回复
你的 m_button应该不是控件变量
而且你的Button样式应该是Owner Draw
canoe_eyes 2003-07-20
  • 打赏
  • 举报
回复
你用RELEASE版编译试试!
lanfanghelanfanghe 2003-07-20
  • 打赏
  • 举报
回复
请大家帮忙呀
slimsymphony 2003-07-20
  • 打赏
  • 举报
回复
the brother upstairs',you'd better show how to call the CBitmapButton object’s AutoLoad function,or how to using as parameters the button’s control ID and the CDialog object’s this pointer.

Ariesman 2003-07-20
  • 打赏
  • 举报
回复
建议不要AutoLoad

m_button.LoadBitmaps(COPYU,COPYD);
Ariesman 2003-07-20
  • 打赏
  • 举报
回复
没有加载位图。

To include a bitmap-button control in a dialog box, follow these steps:

Create one to four bitmap images for the button.


Create a dialog template with an owner-draw button positioned where you want the bitmap button. The size of the button in the template does not matter.


Set the button’s caption to a value such as “MYIMAGE” and define a symbol for the button such as IDC_MYIMAGE.


In your application’s resource script, give each of the images created for the button an ID constructed by appending one of the letters “U,” “D,” “F,” or “X” (for up, down, focused, and disabled) to the string used for the button caption in step 3. For the button caption “MYIMAGE,” for example, the IDs would be “MYIMAGEU,” “MYIMAGED,” “MYIMAGEF,” and “MYIMAGEX.” You must specify the ID of your bitmaps within double quotes. Otherwise the resource editor will assign an integer to the resource and MFC will fail when loading the image.


In your application’s dialog class (derived from CDialog), add a CBitmapButton member object.


In the CDialog object’s OnInitDialog routine, call the CBitmapButton object’s AutoLoad function, using as parameters the button’s control ID and the CDialog object’s this pointer.




.


Call the Create function to create the Windows button control and attach it to the CBitmapButton object.
xtuzi 2003-07-20
  • 打赏
  • 举报
回复
LoadBitmaps

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧