Solved

Printing Bitmap in the Center

Posted on 1998-08-06
2
250 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

726 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