个人研究
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/* 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);
|