向打印机打印图像,代码如下,结果是空白的,求教,//pDC: pointer to the DC of a Printer:
...........
HICON hIcon = AfxGetApp()->LoadIcon( IDR_AUTOCLTYPE ) ;
pDC->DrawIcon ( nOx, nOy, hIcon ); // load BITMAP from our resources
CBitmap bmp;
if (bmp.LoadBitmap(IDB_STATEICONS))
{
// Get the size of the bitmap
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC); CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp); pDC->BitBlt(nOx, nOy, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
}
.....
...........
HICON hIcon = AfxGetApp()->LoadIcon( IDR_AUTOCLTYPE ) ;
pDC->DrawIcon ( nOx, nOy, hIcon ); // load BITMAP from our resources
CBitmap bmp;
if (bmp.LoadBitmap(IDB_STATEICONS))
{
// Get the size of the bitmap
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC); CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp); pDC->BitBlt(nOx, nOy, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
}
.....
写在onpaint函数里试试
download from www.orient-orchid.com