Solved

Print Preview

Posted on 1998-08-20
3
202 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
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

803 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