VC对话框初始时,Picture Control显示BMP图片:
BOOL CLoginDog::OnInitDialog() { CDialog::OnInitDialog(); HBITMAP hBitmap; //添加登陆窗口中的图片 //关联图片ID hBitmap =(HBITMAP)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_LOGIN_PIC), IMAGE_BITMAP,0,0, LR_LOADMAP3DCOLORS); CStatic *pStatic=(CStatic *)GetDlgItem(IDC_STATIC_PIC); //获得指向静态控件的指针 pStatic->ModifyStyle(0xF,SS_BITMAP|SS_CENTERIMAGE); //设置静态控件的样式,使其位图 居中 pStatic->SetBitmap(hBitmap); //设置静态控件显示位图 return TRUE; }
SetBitmap定义如下:
// uBmpResource:图片ID; uCtrlResource: Picture控件 ID void SetBitmap(UINT uBmpResource, UINT uCtrlResource) { HBITMAP hBitmap; CStatic *pStatic = (CStatic *)GetDlgItem(uCtrlResource); hBitmap = (HBITMAP)LoadImage( AfxGetInstanceHandle(), MAKEINTRESOURCE(uBmpResource), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); pStatic->ModifyStyle(0xF, SS_BITMAP); pStatic->SetBitmap(hBitmap); }
以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索图片
, 控件
, 静态
, hbitmap
, 图片vc++rgbmfc
图片vc对话框
vc picture control、picture control、mfc picture control、mfc中picture control、picture control 控件,以便于您获取更多的相关知识。
时间: 2024-09-18 13:41:28