无法加载位图 [英] Unable to load Bitmap

查看:105
本文介绍了无法加载位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用以下命令更改画面控制位图时,什么都没有发生.我做错了什么?

When I try and change the picture control bitmap using the commands below nothing happens. What am I doing wrong?

pStatic-> ModifyStyle(0, SS_BITMAP);
pStatic-> SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP2)));


这是带有调用的代码段.


Here is the the code segment with the calls.

void CHebrewDlg::OnBnClickedNext()
{
	CEdit *pCtrl = (CEdit*) GetDlgItem(IDC_EDIT1);
	CButton *pNormal = (CButton*) GetDlgItem(IDC_RADIO1);
	CButton *pRandom = (CButton*) GetDlgItem(IDC_RADIO2);
	CStatic *pStatic = (CStatic*) GetDlgItem(IDC_STATIC); //IDC_BITMAP is CStatic control,


	int static count = 0;
	int random_count = 0;
	wchar_t hebrew_ch[30] = { L'א', L'בּ', L'ב', L'ג', L'ד', L'ה', L'ו', L'ז', L'ח', L'ט', 
	                          L'י', L'כּ', L'כ', L'ל', L'מ', L'נ', L'ס', L'ע', L'פּ', L'פ',        
	                          L'צ', L'ק', L'ר', L'שׁ', L'שׂ', L'ת' };


	pStatic-> ModifyStyle(0, SS_BITMAP);
	pStatic-> SetBitmap(::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP2)));
	
	if((pNormal->GetCheck()) == 1)
	{
		pCtrl->SetWindowTextW((CString)hebrew_ch[count]);
		count = ++count % 26;	
	}
	else
	{
		random_count = (rand() % 26);
		pCtrl->SetWindowTextW((CString)hebrew_ch[random_count]);
	}
}




[edit]添加了代码块,将我的内容作为纯文本..."选项已禁用,标签-OriginalGriff [/edit]




[edit]Code block added, "Treat my content as plain text..." option disabled, Tags - OriginalGriff[/edit]

推荐答案

您可以在其中使用pStatic-> ModifyStyle(SS_BLACKFRAME,SS_BITMAP);
hi there you can use pStatic->ModifyStyle( SS_BLACKFRAME, SS_BITMAP );


您的代码应能正常工作.请记住,在静态图片控件(对话框编辑器)的属性中,键入并将其设置为位图"(默认为框架).
Your code shoud work. Remember, in the static picture control (dialog editor), properties, type, set it to "Bitmap" (by default is frame).


这篇关于无法加载位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆