Solved

Print Preview

Posted on 1998-08-20
3
199 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
  • 2
3 Comments
 
LVL 14

Accepted Solution

by:
waty earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now