Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: Zooming text

104| Sun, 02 Dec 2007 07:56:00 GMT| jeroenh| Comments (0)
Hi,

I'm building an app with a printpreview.

The printpreview prints the contents of a RichtTextbox to a PictureBox that was made the exact size of the paper used.

Now I want to be able to zoom.
I have tried the PaintPicture method using the Image of the picturebox, but I can't get it to work. Zooming in is no problem, but zooming out is.

Here is my code, just put it in a form with a commandbutton array and a picturebox.

Option Explicit

Private Sub Command1_Click(Index As Integer)
Dim vImage As IPictureDisp
Dim vZoom As Double
If Index = 0 Then
vZoom = 0.9
Else
vZoom = 1.1
End If
Set vImage = Picture1.Image
Picture1.Width = Picture1.Width * vZoom
Picture1.Height = Picture1.Height * vZoom
Picture1.PaintPicture vImage, 0, 0, vImage.Width * vZoom, vImage.Height * vZoom
Set vImage = Nothing
End Sub

Private Sub Form_Load()
Dim i As Long
For i = 1 To 50
Picture1.Print "Dit is regel " & i
Next
End Sub

Any suggestions?

Keywords & Tags: zooming, text, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/560812/
 
«« Prev - Next »» 0 helpful answers below.

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories