Solved

Printing Bitmap in the Center

Posted on 1998-08-06
2
226 Views
Last Modified: 2013-11-20
Hi friends,
                I want to print a bitmap in the center of the page.
               I used CDib class and made  my changes in the OnDraw()
function.It's getting printed only in the top even though I changed  my  left and topmost position.
Can anyone please help me.
Thaxs in advance.

0
Comment
Question by:tmmet
2 Comments
 

Author Comment

by:tmmet
ID: 1320351
Edited text of question
0
 
LVL 7

Accepted Solution

by:
psdavis earned 20 total points
ID: 1320352
I'm going to be that it's a mapping mode problem.  If you're printer is using the pDC->SetMapMode( MM_TWIPS ) for example, then all of your coordinates need to be multiplied by 1440.  

Here's a snipplet of some code that I use to display stuff on the printer.  Notice the MapMode conversion.

BITMAP bm;
pLogo.GetBitmap( &bm );

CPoint ptSize( bm.bmWidth, bm.bmHeight );      
pDC->DPtoLP( &ptSize );      

CPoint ptOrg(0,0);
pDC->DPtoLP(&ptOrg );   // Create a memory DC compatible with the destination DC

CDC pMemDC;
pMemDC.CreateCompatibleDC( pDC );
pMemDC.SetMapMode( pDC->GetMapMode() );      
 
CBitmap* pOldBitmap = (CBitmap*) pMemDC.SelectObject( &pLogo );      

Phillip


0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Shell script to login to remote m/c and execute commands 10 78
java ^ examples 8 66
abstract class with all non abstract mentods 6 76
noX challenge 17 117
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…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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 video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

777 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