-
Dec 5th, 2022, 08:53 AM
#1
Thread Starter
New Member
-
Dec 5th, 2022, 10:10 AM
#2
Re: Help I can't adjust Picture in PrintDocument
Try setting Left, Top, Width, Height...
Code:
e.graphics.drawimage(db, l, t, w, h)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 5th, 2022, 10:14 AM
#3
Re: Help I can't adjust Picture in PrintDocument
Code:
PrintPreviewDialog1.ToString() ???
That does nothing.
Try changing that line to...
Code:
PrintPreviewDialog1.WindowState = FormWindowState.Maximized
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Dec 5th, 2022, 09:52 PM
#4
Thread Starter
New Member
Re: Help I can't adjust Picture in PrintDocument
I will try it thank you, i just put it because when i click print preview twice there is an error on the code and when after i put the .tostring the error is gone and i can check the print preview several times
-
Dec 5th, 2022, 10:36 PM
#5
Thread Starter
New Member
Re: Help I can't adjust Picture in PrintDocument
This what happen when put length and top
Attachment 186382
-
Dec 6th, 2022, 05:02 AM
#6
Re: Help I can't adjust Picture in PrintDocument
Try this...
Code:
Imports System.Drawing.Printing
Public Class Form1
Private WithEvents PrintDocument1 As New PrintDocument
Private ppd As New PrintPreviewDialog With {.Document = PrintDocument1, .windowstate = FormWindowState.Maximized}
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ppd.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim img As New Bitmap("a bitmap")
Dim l As Integer
Dim t As Integer
Dim w As Integer = img.Width
Dim h As Integer = img.Height
If w > e.PageBounds.Width Then
w = e.PageBounds.Width
h = CInt(w / img.Width * img.Height)
End If
If h > e.PageBounds.Height Then
h = e.PageBounds.Height
w = CInt(h / img.Height * img.Width)
End If
l = CInt(e.PageBounds.Left + ((e.PageBounds.Width - w) / 2))
t = CInt(e.PageBounds.Top + ((e.PageBounds.Height - h) / 2))
e.Graphics.DrawImage(img, l, t, w, h)
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|