个人研究
/* CStatic*pWnd = ((CStatic *)GetDlgItem(IDC_TEST)); pWnd->ModifyStyle(0, SS_BITMAP); /* pWnd->SetBitmap((HBITMAP)::LoadImage(NULL, _T("Rockies.bmp"), //资源号或本地文件名 IMAGE_BITMAP, //装载位图 IMAGE_CURSOR光标 IMAGE_ICON图标 0, //宽度 0为默认大小 0, //高度 像素为单位 LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE));*/ /*pWnd->SetBitmap((HBITMAP)::LoadImage(NULL, _T("21.bmp"), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_DEFAULTSIZE | LR_LOADFROMFILE)); Sleep(5000); HBITMAP hBitmap; /CBitmap st; st.LoadBitmap(IDB_BITMAP3); */ CWnd *cW = GetDlgItem(IDC_BITMAP); CRect rec; cW->GetWindowRect(rec); this->ScreenToClient(rec); rec.DeflateRect(4,4); cW->MoveWindow(rec); int cx, cy; CImage image; CRect rect; //载入图片 image.Load(_T("E:\\21.bmp")); //获取图片高宽 cx = image.GetWidth(); cy = image.GetHeight(); //获取Pirture Control大小 GetDlgItem(IDC_TEST)->GetWindowRect(rect); this->ScreenToClient(rect); GetDlgItem(IDC_TEST)->MoveWindow(rect.left, rect.top, cx, cy, TRUE); // TODO: 在此添加控件通知处理程序代码*/ CWnd*pWnd = ((CStatic*)GetDlgItem(IDC_TEST)); if (pWnd == NULL) return; pWnd->GetClientRect(&rect); CDC*pDc = NULL; pDc = pWnd->GetDC(); image.Draw(pDc->m_hDC, rect); ReleaseDC(pDc); Sleep(20); CWnd *cW1 = GetDlgItem(IDC_BITMAP); CRect recR; cW1->GetWindowRect(recR); this->ScreenToClient(recR); recR.InflateRect(4, 4); cW1->MoveWindow(recR); // Sleep(1000);