Solved

Printing Bitmap in the Center

Posted on 1998-08-06
2
204 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
Comment Utility
Edited text of question
0
 
LVL 7

Accepted Solution

by:
psdavis earned 20 total points
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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