- 环境:vs2019,Unicode,C++
- 在 OnInitDialog() 里加入以下代码:
BOOL CMy005MFCHalconDlg::OnInitDialog() { // TODO: 在此添加额外的初始化代码 int iImgWidth = 1280, iImgHeight = 1024; int iImgZoomWidth = iImgWidth / 2, iImgZoomHeight = iImgHeight / 2; CRect rectPic; GetDlgItem(IDC_PICTURE)->GetWindowRect(&rectPic); // IDC_PICTURE 是 picture control 的 ID ScreenToClient(&rectPic); GetDlgItem(IDC_PICTURE)->MoveWindow(rectPic.left, rectPic.top, iImgZoomWidth, iImgZoomHeight, true); return true; }