在对话框放了一个按钮为IDC_BUTTON1..Dlg类中加入了CBitmapButton m_button然后画了一个位图ID为"COPYU",又画了一个为"COPYD"在OnInitDialog()中加入了VERIFY(m_button.AutoLoad(IDC_BUTTON1,this));为什么执行时会出现异常?
解决方案 »
- 如何监控多个文件夹
- installshield12 如何注册msxml4.dll
- 计算今天之后第一个工作日(100分)
- 关于 Event得问题!!!!!
- DAO编程需要包含哪些头文件?
- 在画图问题中的简单问题
- puyinghua进来拿分
- 请问怎样初始化结构数组的指针?急用!!!!!!!!
- EVC中MENU的显示问题,很奇怪
- 在线等待,急!急!网络环境下的...?
- e:\winapi\test5\jd.cpp(28) : fatal error unexpected end of file while looking for precompiled header directive
- TreeCtrl怎么样保持现有的打开状态
而且你的Button样式应该是Owner Draw
CButton m_button;
然后把手动CButton改为CBitmapButton
其他的地方不需要如InitialDialog里不用AutoLoad
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.