Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Why does ImageList_DrawEx produce no output when printing?

$
0
0

I am using the following call to draw an icon:

ImageList_DrawEx(hImageList, 1, hDC, ptX, ptY, 0, 0, CLR_NONE, CLR_NONE, ILD_IMAGE);

This works fine on-screen and in print preview but produces no output when printing (even though the function returns success - i.e. TRUE).  Can anyone suggest why this is happening and what I can do to fix it?  The image list contains 32-bits bitmap images (RGB with an Alpha channel) created with lines like this:

HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_IL_ICONS), IMAGE_BITMAP, 0, 0,  LR_CREATEDIBSECTION);
CBitmap bm;
BOOL bOK = bm.Attach(hbm);
ASSERT(bOK);
CImageList list;
list.Create(24, 24, ILC_COLOR32, 12, 0);
list.Add(&bm, (CBitmap *)NULL); // no mask required (ILC_COLOR32 = RGB/A-32bits)
HIMAGELIST hImageList = list.GetSafeHandle();

As I say, it works fine everywhere except printing.  But I can't find any documentation that says that it doesn't work with a printer DC.  If that's the case, though, can anyone suggest an easy workaround?

TIA


Simon


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>