Print Preview

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
Who is Participating?
watyConnect With a Mentor Commented:
I have written a complete Print Preview OCX.
It is a shareware.

You can download it from my web site :

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.
gaAuthor Commented:
Yes, this is exacty what i'm looking for and I'm very interested
in a part of your code
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.