Elimdeki JPEG dosyası A4 sayfaya yazılmış bir doc dosyasının resmidir.
Elimdeki JPEG dosyasını A4 sayfaya tam olarak sığdırması için kodun neresini değiştirmem gerekiyor ?
Option Explicit
' Print the PictureBox's picture with upper left
' corner at (1440, 1440). Then draw a box around
' the picture.
Private Sub cmdPrint_Click()
Dim wid As Single
Dim hgt As Single
' Set the PictureBox's ScaleMode to pixels to
' make things interesting.
picCanvas.ScaleMode = vbPixels
' Print the picture.
Printer.PaintPicture picCanvas.Picture, _
1440, 1440
' Get the picture's dimensions in the printer's
' scale mode.
wid = ScaleX(picCanvas.ScaleWidth, picCanvas.ScaleMode, Printer.ScaleMode)
hgt = ScaleY(picCanvas.ScaleHeight, picCanvas.ScaleMode, Printer.ScaleMode)
' Draw the box.
Printer.Line (1440, 1440)-Step(wid, hgt), , B
' Finish printing.
Printer.EndDoc
MsgBox "Done"
End Sub
Private Sub Form_Load()
Const SAMPLE_TEXT As String = "Geodesic Sphere"
' Draw on the picture.
picCanvas.Font.Name = "Times New Roman"
picCanvas.Font.Size = 24
picCanvas.Font.Bold = True
picCanvas.ForeColor = vbBlack
' Center the text horizontally at the top
' of the picture.
picCanvas.CurrentX = (picCanvas.ScaleWidth - picCanvas.TextWidth(SAMPLE_TEXT)) / 2
picCanvas.CurrentY = 0
picCanvas.AutoRedraw = True
picCanvas.Print SAMPLE_TEXT
' Make the text a permanent part of the image.
' This is important if you later need to copy
' the picture to another control or the Printer.
picCanvas.Picture = picCanvas.Image
End Sub