|
-
Nov 2nd, 2007, 05:16 AM
#1
Thread Starter
Hyperactive Member
[2005] Set Margins WHen Printing
Hi
I have coded this little report, however some information goes straight off the page, due to the quantity of words, oes anyone know how I would set the margins or page boundaries?
I have seen a couple of properties that look good, like e.MarginBonds and e.PageBounds but I always get errors when trying to pass values to them.
Anyway below is mi code
Code:
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim font As New Font("Verdana", 12, FontStyle.Bold)
Dim fontx As New Font("Verdand", 11, FontStyle.Regular)
Dim title As New Font("Verdana", 20, FontStyle.Regular)
Dim x As Integer
Dim y As Integer
Dim objright As Integer = 100
x = 50
y = 50
'margins of page
'e.PageSettings.Margins.Left = 10
'e.PageSettings.Margins.Top = 50
'e.PageSettings.Margins.Bottom = 40
'e.PageSettings.Margins.Right = 100
' e.PageBounds.Right.Equals(objright)
e.Graphics.DrawImage(PictureBox1.Image, x + 440, 50)
e.Graphics.DrawString("Problem Overview Report", title, Brushes.Black, x, y + 40)
e.Graphics.DrawString("____________________________________________________", title, Brushes.Black, x, y + 80)
e.Graphics.DrawString("Name:", font, Brushes.Black, x, y + 220)
e.Graphics.DrawString("Problem:", font, Brushes.Black, x, y + 300)
e.Graphics.DrawString("Problem Submitted:", font, Brushes.Black, x, y + 340)
e.Graphics.DrawString("Solved:", font, Brushes.Black, x, y + 410)
e.Graphics.DrawString("Solved At:", font, Brushes.Black, x, y + 560)
e.Graphics.DrawString("Solution:", font, Brushes.Black, x, y + 620)
x = x + 70
e.Graphics.DrawString(ObjName, fontx, Brushes.Black, x, y + 220)
e.Graphics.DrawString(ObjProblem, fontx, Brushes.Black, x + 20, y + 300)
e.Graphics.DrawString(ObjProblemDescription, fontx, Brushes.Black, x + 120, y + 340)
e.Graphics.DrawString(ObjSolved, fontx, Brushes.Black, x + 20, y + 410)
e.Graphics.DrawString(ObjSolvedAt, fontx, Brushes.Black, x + 30, y + 560)
e.Graphics.DrawString(ObjSolution, fontx, Brushes.Black, x + 30, y + 620)
End Sub
Learning C♯
Data Binding & Bound Controls - Objects and wizards will never be as intelligent as you, do it yourself! (Unless your Pro)
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
|