Solved

bitmap from a minimized window

Posted on 1998-04-01
7
199 Views
Last Modified: 2013-12-03
I am trying to get a full document (that goes beyond the length of the window) and store the document as a bitmap so that I can send it to a device context.  My end goal is to be able to print the document so it looks the same no matter the size or shape of the window containing the document.
0
Comment
Question by:curtisn
[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
  • 4
  • 3
7 Comments
 

Author Comment

by:curtisn
ID: 1412486
Edited text of question
0
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1412487
You need to create a memory device context.  Create a bitmap of the necessary size and select it into the memory DC. and draw the document into the memory device context.

Do you know any of these steps?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1412488
I can give you details (there are a lot of them!).  But now that I think about, I'm not sure that is what you really want.

If you just want to print something, you don't need to create a bitmap.  When you print you have a DC for the printer.  The DC can be used to draw up to an entire page at a time.  Why can't you just draw what you need to the printer DC?
0
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!

 
LVL 22

Expert Comment

by:nietod
ID: 1412489
Perhaps what you really need to do is design you program so that you can "draw" to any DC.  To do this you need to create a single "draw" procedure that takes a DC as a parameter.  When a window needs to be painted, it gets a DC from BeginPaint() and calls your draw procedure.  When you need to print, you get a DC for the printer and call the draw procedure with it.
0
 

Author Comment

by:curtisn
ID: 1412490
I'm still not sure how to create a bitmap from a window where I can't see the entire desired bitmap.  But I like your comment about printing right to the printerDC,  the original programmer, didn't have any printing functionality And I have been asked to come up with it.  I was thinking using the BitBlt function with a bitmap, Which way do you think is best?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1412491
Now that I think about it.  the BitBlt solution makes no sense.  Why?  because to use it you will need to create a memory DC that uses a bitmap the size of the page (That's what I origianlly proposed).  But then you need to draw to that memory DC.  So you still are going to need a procedure for drawing to a DC that is not the window's client areaa DC.  What makes it a bad solution is that after drawing to the memory DC, you must bitblt the image to the printer DC.  Why not just draw to the printer DC in the first place?

Now if you want to know how to create and draw to a bitmap, I can explain it.  But there quite a few steps involved.  However, I don't think that is the best way of handling your problem, at least not with the infornation you have presented so far.  If you have more questions, ask them now.  I am leaving tommorrow morning and will be gone until Tueasday the 7th.
0
 

Author Comment

by:curtisn
ID: 1412492
That works, I will just draw straight to the printerDC, Thanks
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
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…

739 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