Printing BMP with MFC

Posted on 1998-05-11
Last Modified: 2013-11-20
When I'm printing a bitmap that I load from a file on disk, all that gets printed is a black box. Lines and text are printed correctly.

Here is a sample of the code I use....

CDC *pDC = new CDC;
pDC->StartDoc("My Document");
CFont *pFont;
CDC dcImage;
if (dcImage.CreateCompatibleDC(pDC))
      CBitmap m_Bmp;
pFont = pDC->SelectObject(&font);

Would appreciate any help with this.
Question by:k9

Accepted Solution

piano_boxer earned 100 total points
ID: 1309472
You need to convert the bitmap to a DIB and use StretchBlt
Take a look at this sample:

Author Comment

ID: 1309473
Thanks for the help!

Seems to be working OK now.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 92
no14 challenge 14 62
building a service to accessed via telnet client, want colors ? 4 80
Excel file not created as expected 7 46
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now