?
Solved

Print Preview

Posted on 1998-08-20
3
Medium Priority
?
206 Views
Last Modified: 2010-04-30
How can I make a printpreview that's will be exactly that same as my printout
For example: When I make a preview of 50%, I have to multiply every line etc. with 0.5, but when I multiply the fontsize with 0.5, the fontsize isn't exactly 50%
My preview is not always the exactly same as my printout
0
Comment
Question by:ga
[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
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 400 total points
ID: 1429994
I have written a complete Print Preview OCX.
It is a shareware.

You can download it from my web site :
  http://www.come.to/printpreview.com
or
  http://www.geocities.com/ResearchTriangle/6311/

In general, in my Print Preview, I write all the text, pictures... in a picturebox. To zoom/unzoom, I make call to APIs.
If it is what you want, I can send you some part of code.
0
 

Author Comment

by:ga
ID: 1429995
Yes, this is exacty what i'm looking for and I'm very interested
in a part of your code
0
 
LVL 14

Expert Comment

by:waty
ID: 1429996
Here is my routine to strech one picture to another one :

Before calling to the strech API, set the right dimension of the picture destination.


Declare Function SetStretchBltMode Lib "gdi32" (ByVal hdc As Long, ByVal nStretchMode As Long) As Long
Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

Private Sub Stretch(Src As Control, Dest As Control, StretchMode As Long)
   ' *** Stretch pictures ***
   Dim nHoldSrcMode     As Long
   Dim nHoldDestMode    As Long
   
   Dim XSrc             As Long
   Dim YSrc             As Long
   Dim XDest            As Long
   Dim YDest            As Long
   
   Dim nSrcWidth        As Long
   Dim nSrcHeight       As Long
   Dim nDestWidth       As Long
   Dim nDestHeight      As Long
   
   Dim hSrcDC           As Long
   Dim hDestDC          As Long
   
   Dim nRet             As Long
   
   Const SRCCOPY = &HCC0020
   
   On Error Resume Next
   
   nHoldSrcMode = Src.ScaleMode
   nHoldDestMode = Dest.ScaleMode
   
   Src.ScaleMode = 3
   Dest.ScaleMode = 3
   
   XSrc = 0
   YSrc = 0
   nSrcWidth = Src.ScaleWidth
   nSrcHeight = Src.ScaleHeight
   
   XDest = 0
   YDest = 0
   nDestWidth = Dest.ScaleWidth
   nDestHeight = Dest.ScaleHeight
   
   hSrcDC = Src.hdc
   hDestDC = Dest.hdc
   
   nRet = SetStretchBltMode(hDestDC, StretchMode)
   nRet = StretchBlt(hDestDC, XDest, YDest, nDestWidth, nDestHeight, hSrcDC, XSrc, YSrc, nSrcWidth, nSrcHeight, SRCCOPY)
   
   Src.ScaleMode = nHoldSrcMode
   Dest.ScaleMode = nHoldDestMode
   
End Sub

0

Featured Post

Industry Leaders: 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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 4 hours left to enroll

752 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