我现在想要对一个对话框实施打印,但是只能打印对话框的一部分,请问如何修改下面程序
CRect m_rect;
//获取图像的大小
MyStatic.GetClientRect(m_rect);
CDC* pImageDC = MyStatic.GetDC(); //获得控件画布
int formx, formy;
//获得屏幕分辨率
formx = pImageDC->GetDeviceCaps(LOGPIXELSX);
formy = pImageDC->GetDeviceCaps(LOGPIXELSY);
ReleaseDC(pImageDC);
CPrintDialog m_printdlg(FALSE); //构造打印对话框
if (m_printdlg.DoModal() == IDOK)
{
CDC pdc;
pdc.Attach(m_printdlg.GetPrinterDC());
//获取打印机与屏幕的分辨率比率
int printerx, printery;
printerx = pdc.GetDeviceCaps(LOGPIXELSX);
printery = pdc.GetDeviceCaps(LOGPIXELSY);
double ratex, ratey;
ratex = (double)printerx / formx;
ratey = (double)printery / formy;
CClientDC dc(this);
CBitmap bmp;
bmp.CreateCompatibleBitmap(&dc, m_rect.Width(), m_rect.Height()); //创建位图
CDC imagedc;
imagedc.CreateCompatibleDC(&dc); //创建兼容的画布
imagedc.SelectObject(&bmp); //选入位图
imagedc.BitBlt(0, 0, m_rect.Width(), m_rect.Height(), &dc, 0, 0, SRCCOPY); //绘制位图
//打印图像
pdc.StartDoc("ceshi");
pdc.StretchBlt(0, 0, (int)(m_rect.Width()*ratex), (int)(m_rect.Height()*
ratey), &imagedc, 0, 0, m_rect.Width(), m_rect.Height(), SRCCOPY);
pdc.EndDoc();
}