分类: C/C++
2008-12-10 22:05:50
+ rcClient {top=40 bottom=355 left=14 right=434} CRect
+ rcClient {top=11 bottom=326 left=11 right=431} CRect
+ rcWindow {top=0 bottom=313 left=0 right=418} CRect
+ rcWindow {top=41 bottom=354 left=15 right=433} CRect
// 对话框还没有移动,Dialog原点与屏幕坐标原点都为(0,0)处绘制
BOOL CMPEGTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
CRect rcClient, rcWindow;
GetDlgItem(IDC_STA_PREVIEW)->GetWindowRect(&rcClient);
ScreenToClient(&rcClient);
GetDlgItem(IDC_STA_PREVIEW)->GetClientRect(&rcWindow);
GetDlgItem(IDC_STA_PREVIEW)->ClientToScreen(&rcWindow);
return TRUE;
}
/*******************************************************/
+ rcClient {top=275 bottom=590 left=510 right=930} CRect
+ rcClient {top=11 bottom=326 left=11 right=431} CRect
+ rcWindow {top=0 bottom=313 left=0 right=418} CRect
+ rcWindow {top=276 bottom=589 left=511 right=929} CRect
// 对话框移动应该所在的位置,以屏幕坐标为原点处绘制
void CMPEGTestDlg::OnPaint()
{
CPaintDC dc(this); // 用于绘制的设备上下文
// 相差一象素是因为IDC_STA_PREVIEW的边框占一朴素
CRect rcClient, rcWindow;
GetDlgItem(IDC_STA_PREVIEW)->GetWindowRect(&rcClient);
ScreenToClient(&rcClient);
GetDlgItem(IDC_STA_PREVIEW)->GetClientRect(&rcWindow);
GetDlgItem(IDC_STA_PREVIEW)->ClientToScreen(&rcWindow);
}