VC++ MFC Button 显示图片的问题:
先在.h中定义 :CBitmapButton m_Calling;
然后在:DoDataExchange(CDataExchange* pDX)中
DDX_Control(pDX, IDC_BNT_MAKECALL, m_Calling);关联到Button
然后在
OnInitDialog() 中 m_Calling.LoadBitmaps (IDR_JPG1);
IDR_JPG1为一张导入的JPG图片。
结果Button显示为空白,什么都不显示,请问怎么回事?
[最优解释]
不支持JPG的吧,用bmp试试
[其他解释]
LoadBitmaps只支持位图文件,不支持JPG。同时该按钮属性应该设置为OWNER_DRAW
[其他解释]
是的,只支持bmp的
[其他解释]
CBitmapButton使用需要注意一些问题的CBitmapButton的使用
[其他解释]
改成 bmp文件了,按钮属性设置为OWNER_DRAW,早就设置了,可是还是不行哦,现在 回去这个button时出现错误 :
Program F:\xx\xx.exe
File:f:\dd\vctools\vc7libs\ship\atlmfc\src\wincore.cpp (我电脑中无此目录及文件)
line:379
for information on how your grogram can cause an assertion failure,see the Visual C++ documentation on asserts.
中止,重试,忽略 (三个Button)
[其他解释]
你要用4张图片作为资源Load进来
[其他解释]
// Load the bitmaps for this button.
pmyButton->LoadBitmaps(IDB_UP, IDB_DOWN, IDB_FOCUS, IDB_DISABLE);
// Resize the button to be the size of the bitmaps.
pmyButton->SizeToContent();
[其他解释]
m_Calling.SizeToContent (); 这一行又出现 Debug Assertion failed! 错误。
Program F:\xx\xx.exe
File:f:\dd\vctools\vc7libs\ship\atlmfc\src\wincore.cpp (我电脑中无此目录及文件)
line:379
for information on how your grogram can cause an assertion failure,see the Visual C++ documentation on asserts.
中止,重试,忽略 (三个Button)
[其他解释]
那就是你控件没关联好了,看看ID是不是写错了
[其他解释]
to hurryboylqs 控件关联好了,ID 没有写错啊。可以加下QQ么?三一一9333 谢谢!
[其他解释]
第一次选库的时候就把CBitmapButton给排除了,毅然选择了CButtonST。
例子呈现效果差距太大。
[其他解释]
该回复于2012-12-01 09:24:31被管理员删除