MFC单文档编程!
给sdi工程的view类添加成员变量 CStatic m_picture;
给view类添加WM_CREATE消息响应函数(ClassView-Add Message Handler)
int CMfcsdiView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
m_picture.Create(_T(""), WS_CHILD|WS_VISIBLE|SS_BITMAP, CRect(10,10,60,60), this,8000);
HBITMAP bmp = (HBITMAP)LoadImage(AfxGetInstanceHandle(),
"mfc-logo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);
m_picture.SetBitmap(bmp);
m_picture.ShowWindow(SW_SHOW);
return 0;
}
Create的最后一个参数常量值 不要和已经存在的各种资源ID值冲突 ,可以随意填