Click here to Skip to main content
15,923,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I print a bitmap file ? Pin
manio18-Dec-01 18:32
manio18-Dec-01 18:32 
GeneralRe: How can I print a bitmap file ? Pin
Christian Graus18-Dec-01 18:50
protectorChristian Graus18-Dec-01 18:50 
GeneralRe: How can I print a bitmap file ? Pin
18-Dec-01 20:53
suss18-Dec-01 20:53 
GeneralRe: How can I print a bitmap file ? Pin
Christian Graus19-Dec-01 1:02
protectorChristian Graus19-Dec-01 1:02 
GeneralRe: How can I print a bitmap file ? Pin
manio21-Dec-01 0:44
manio21-Dec-01 0:44 
GeneralRe: How can I print a bitmap file ? Pin
Christian Graus21-Dec-01 0:55
protectorChristian Graus21-Dec-01 0:55 
GeneralRe: How can I print a bitmap file ? Pin
manio21-Dec-01 0:02
manio21-Dec-01 0:02 
GeneralRe: How can I print a bitmap file ? Pin
Christian Graus21-Dec-01 0:51
protectorChristian Graus21-Dec-01 0:51 
manio wrote:
Now, how can I copy my bitmap data to dc ?

Not AFAIK, in that the command that does this is StretchBlt. I would imagine writing an equally efficient streching routine that does COLORONCOLOR would be tedious, and kind of redundant when it's in front of you. Just create a DIBSection with the width and height, you have a DSC if you want, but if you don't specify PAL_COLORS the DC paramater can be NULL anyhow. Then bitblt your bits into it, and stretchblt to the screen. Yes, you need to make another copy to do that, but that's really the best way I can see.

manio wrote:
And, how about the nWidth ? How to calculate it if I want to print to the original dimension of my bitmap ?

Like I said before, your original bitmap has a dimension that relates to the resolution and size of your monitor - it's NOT a real number, it's a number of pixels. Or do you mean aspect ratio ? Use the ratio of bitmap width to height to calculate the size of the aspect you're not filling the page with. If that comes out too big for the page, use the other one.

For example, if my bitmap is 2 x 3 pixels and I am drawing with a width of 6, I get the height by going 6 * 3 /2 = 9.

manio wrote:
How to calculate pSrcDC ? (Do I just use: dc.StretchBlt(...) as dc mentioned above ? Because there are 2 DCs, I got kind of confused !! )

Once you've created the DIBSection you need to select the HBITMAP returned from CreateDIBSection into a DC. Create it like this:

CDC srcDC;
srcDC.CreateCompatibleDC(&dc);

Now the DC is compatible with the print DC. Select your image into it, and stretchblt. Don't forget to go dc.SetStretchBltMode(COLORONCOLOR);

manio wrote:
I know I probably asked too many questions. Your any reply would be greatly appreciated..

Printing is a pain, printing graphics doubly so. I hope this helped.


Christian

After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

Sonork ID 100.10002:MeanManOz
I live in Bob's HungOut now

Questionwhy no need to declare class CXXXDoc in XXXView.h? Pin
AnonymousBabe@usa.net16-Dec-01 15:15
AnonymousBabe@usa.net16-Dec-01 15:15 
AnswerRe: why no need to declare class CXXXDoc in XXXView.h? Pin
Erik Funkenbusch17-Dec-01 0:00
Erik Funkenbusch17-Dec-01 0:00 
GeneralProgram not starting Pin
16-Dec-01 10:37
suss16-Dec-01 10:37 
GeneralRe: Program not starting Pin
Paul Selormey16-Dec-01 13:08
Paul Selormey16-Dec-01 13:08 
GeneralRe: Program not starting Pin
Lim Bio Liong16-Dec-01 19:36
Lim Bio Liong16-Dec-01 19:36 
GeneralRe: Program not starting Pin
Jon Hulatt17-Dec-01 0:04
Jon Hulatt17-Dec-01 0:04 
GeneralRe: Program not starting Pin
Rickard Andersson2017-Dec-01 0:38
Rickard Andersson2017-Dec-01 0:38 
GeneralRe: Program not starting Pin
Michael P Butler17-Dec-01 1:09
Michael P Butler17-Dec-01 1:09 
GeneralRe: Program not starting Pin
17-Dec-01 2:14
suss17-Dec-01 2:14 
GeneralRe: Program not starting Pin
Michael P Butler17-Dec-01 2:48
Michael P Butler17-Dec-01 2:48 
GeneralRe: Program not starting Pin
17-Dec-01 5:31
suss17-Dec-01 5:31 
GeneralCUIntArray & CList Pin
16-Dec-01 8:40
suss16-Dec-01 8:40 
GeneralRe: CUIntArray & CList Pin
Michael Dunn16-Dec-01 9:00
sitebuilderMichael Dunn16-Dec-01 9:00 
GeneralRe: CUIntArray & CList where the error is Pin
16-Dec-01 9:40
suss16-Dec-01 9:40 
GeneralRe: CUIntArray & CList where the error is Pin
16-Dec-01 10:05
suss16-Dec-01 10:05 
GeneralOLE container ambient properties Pin
Paul S16-Dec-01 6:33
Paul S16-Dec-01 6:33 
GeneralProblem With std::getline And C++ Pin
valikac16-Dec-01 4:44
valikac16-Dec-01 4:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.