home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic .NET - Read Less - Learn More / Visual_Basic.NET_Read_Less_Learn_More_Richard_Bowman_Visual_2002.iso / Resources / Code / Ch5-CreatePrintPreview / Form1.vb < prev   
Text File  |  2001-07-20  |  4KB  |  89 lines

  1. Public Class Form1
  2.     Inherits System.Windows.Forms.Form
  3.  
  4. #Region " Windows Form Designer generated code "
  5.  
  6.     Public Sub New()
  7.         MyBase.New()
  8.  
  9.         'This call is required by the Windows Form Designer.
  10.         InitializeComponent()
  11.  
  12.         'Add any initialization after the InitializeComponent() call
  13.  
  14.     End Sub
  15.  
  16.     'Form overrides dispose to clean up the component list.
  17.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  18.         If disposing Then
  19.             If Not (components Is Nothing) Then
  20.                 components.Dispose()
  21.             End If
  22.         End If
  23.         MyBase.Dispose(disposing)
  24.     End Sub
  25.     Friend WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
  26.     Friend WithEvents PrintPreviewDialog1 As System.Windows.Forms.PrintPreviewDialog
  27.     Friend WithEvents Button1 As System.Windows.Forms.Button
  28.  
  29.     'Required by the Windows Form Designer
  30.     Private components As System.ComponentModel.Container
  31.  
  32.     'NOTE: The following procedure is required by the Windows Form Designer
  33.     'It can be modified using the Windows Form Designer.  
  34.     'Do not modify it using the code editor.
  35.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
  36.         Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
  37.         Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
  38.         Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog()
  39.         Me.Button1 = New System.Windows.Forms.Button()
  40.         Me.PrintPreviewDialog1.SuspendLayout()
  41.         Me.SuspendLayout()
  42.         '
  43.         'PrintPreviewDialog1
  44.         '
  45.         Me.PrintPreviewDialog1.AutoScrollMargin = New System.Drawing.Size(0, 0)
  46.         Me.PrintPreviewDialog1.AutoScrollMinSize = New System.Drawing.Size(0, 0)
  47.         Me.PrintPreviewDialog1.ClientSize = New System.Drawing.Size(400, 300)
  48.         Me.PrintPreviewDialog1.Document = Me.PrintDocument1
  49.         Me.PrintPreviewDialog1.Enabled = True
  50.         Me.PrintPreviewDialog1.Icon = CType(resources.GetObject("PrintPreviewDialog1.Icon"), System.Drawing.Icon)
  51.         Me.PrintPreviewDialog1.Location = New System.Drawing.Point(44, 44)
  52.         Me.PrintPreviewDialog1.MaximumSize = New System.Drawing.Size(0, 0)
  53.         Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"
  54.         Me.PrintPreviewDialog1.Opacity = 1
  55.         Me.PrintPreviewDialog1.UseAntiAlias = True
  56.         Me.PrintPreviewDialog1.Visible = False
  57.         '
  58.         'Button1
  59.         '
  60.         Me.Button1.Location = New System.Drawing.Point(88, 88)
  61.         Me.Button1.Name = "Button1"
  62.         Me.Button1.Size = New System.Drawing.Size(136, 48)
  63.         Me.Button1.TabIndex = 0
  64.         Me.Button1.Text = "Button1"
  65.         '
  66.         'Form1
  67.         '
  68.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
  69.         Me.ClientSize = New System.Drawing.Size(292, 273)
  70.         Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1})
  71.         Me.Name = "Form1"
  72.         Me.Text = "Form1"
  73.         Me.PrintPreviewDialog1.ResumeLayout(False)
  74.         Me.ResumeLayout(False)
  75.  
  76.     End Sub
  77.  
  78. #End Region
  79.  
  80.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  81.         PrintPreviewDialog1.ShowDialog()
  82.  
  83.     End Sub
  84.  
  85.     Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
  86.         e.Graphics.DrawLine(Drawing.Pens.Red, e.MarginBounds.Left, e.MarginBounds.Top, e.MarginBounds.Right, e.MarginBounds.Bottom)
  87.     End Sub
  88. End Class
  89.