Solved

bitmap from a minimized window

Posted on 1998-04-01
7
204 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

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.…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

630 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