⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 printtableform.vb

📁 Mastering VBNet Include Source Code
💻 VB
📖 第 1 页 / 共 2 页
字号:
Option Strict On
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Public Overrides Sub Dispose()
        MyBase.Dispose()
        If Not (components Is Nothing) Then
            components.Dispose()
        End If
    End Sub
    Private WithEvents ListView1 As System.Windows.Forms.ListView
    Private WithEvents Button1 As System.Windows.Forms.Button
    Private WithEvents ISBN As System.Windows.Forms.ColumnHeader
    Private WithEvents Title As System.Windows.Forms.ColumnHeader
    Private WithEvents Authors As System.Windows.Forms.ColumnHeader
    Private WithEvents Authors1 As System.Windows.Forms.ColumnHeader
    Private WithEvents Button2 As System.Windows.Forms.Button
    Private WithEvents PrintPreviewDialog1 As System.Windows.Forms.PrintPreviewDialog
    Private WithEvents PrintDocument1 As System.Drawing.Printing.PrintDocument
    Private WithEvents PageSetupDialog1 As System.Windows.Forms.PageSetupDialog
    Private WithEvents Authors2 As System.Windows.Forms.ColumnHeader

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.Authors2 = New System.Windows.Forms.ColumnHeader()
        Me.PageSetupDialog1 = New System.Windows.Forms.PageSetupDialog()
        Me.PrintPreviewDialog1 = New System.Windows.Forms.PrintPreviewDialog()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.ISBN = New System.Windows.Forms.ColumnHeader()
        Me.Title = New System.Windows.Forms.ColumnHeader()
        Me.ListView1 = New System.Windows.Forms.ListView()
        Me.Authors = New System.Windows.Forms.ColumnHeader()
        Me.Authors1 = New System.Windows.Forms.ColumnHeader()
        Me.PrintDocument1 = New System.Drawing.Printing.PrintDocument()
        Me.SuspendLayout()
        '
        'Authors2
        '
        Me.Authors2.Text = "Author"
        Me.Authors2.Width = 106
        '
        'PrintPreviewDialog1
        '
        Me.PrintPreviewDialog1.AutoScrollMargin = New System.Drawing.Size(0, 0)
        Me.PrintPreviewDialog1.AutoScrollMinSize = New System.Drawing.Size(0, 0)
        Me.PrintPreviewDialog1.ClientSize = New System.Drawing.Size(400, 300)
        Me.PrintPreviewDialog1.Enabled = True
        Me.PrintPreviewDialog1.Location = New System.Drawing.Point(66, 66)
        Me.PrintPreviewDialog1.MaximumSize = New System.Drawing.Size(0, 0)
        Me.PrintPreviewDialog1.Name = "PrintPreviewDialog1"
        Me.PrintPreviewDialog1.Opacity = 1
        Me.PrintPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty
        Me.PrintPreviewDialog1.Visible = False
        '
        'Button1
        '
        Me.Button1.Font = New System.Drawing.Font("Verdana", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(161, Byte))
        Me.Button1.Location = New System.Drawing.Point(136, 280)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(144, 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Populate Grid"
        '
        'Button2
        '
        Me.Button2.Font = New System.Drawing.Font("Verdana", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(161, Byte))
        Me.Button2.Location = New System.Drawing.Point(352, 280)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(152, 32)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Preview && Print"
        '
        'ISBN
        '
        Me.ISBN.Text = "ISBN"
        Me.ISBN.Width = 80
        '
        'Title
        '
        Me.Title.Text = "Title"
        Me.Title.Width = 225
        '
        'ListView1
        '
        Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.ISBN, Me.Title, Me.Authors, Me.Authors1, Me.Authors2})
        Me.ListView1.Font = New System.Drawing.Font("Verdana", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(161, Byte))
        Me.ListView1.Location = New System.Drawing.Point(8, 8)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(640, 264)
        Me.ListView1.TabIndex = 0
        Me.ListView1.View = System.Windows.Forms.View.Details
        '
        'Authors
        '
        Me.Authors.Text = "Main Author"
        Me.Authors.Width = 120
        '
        'Authors1
        '
        Me.Authors1.Text = "Author"
        Me.Authors1.Width = 92
        '
        'PrintDocument1
        '
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(648, 317)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.Button1, Me.ListView1})
        Me.Name = "Form1"
        Me.Text = "Printing Tabular Data"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim BookItem As New ListViewItem()
        BookItem.Text = "0393049515"
        BookItem.SubItems.Add("The Dream of Reason: A History of Philosophy from the Greeks to the Renaissance")
        BookItem.SubItems.Add("Anthony Gottlieb")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0156445085"
        BookItem.SubItems.Add("In Search of the Miraculous : Fragments of an Unknown Teaching ")
        BookItem.SubItems.Add("P. D. Ouspensky")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0472065211"
        BookItem.SubItems.Add("Simulacra and Simulation")
        BookItem.SubItems.Add("Jean Baudrillard")
        BookItem.SubItems.Add("Sheila Faria Glaser")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0060637633"
        BookItem.SubItems.Add("Basic Writings : From Being and Time (1927 to the Task of Thinking)")
        BookItem.SubItems.Add("Martin Heidegger")
        BookItem.SubItems.Add("David Farrell Krell")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "1566632625"
        BookItem.SubItems.Add("Locke in 90 Minutes")
        BookItem.SubItems.Add("Paul Strathern")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0860917045"
        BookItem.SubItems.Add("Minima Moralia : Reflections from Damaged Life")
        BookItem.SubItems.Add("Theodor Wiesengrund Adorno")
        BookItem.SubItems.Add("E.F.Jephcott")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "1890318663"
        BookItem.SubItems.Add("The Defamation of Pius XII")
        BookItem.SubItems.Add("Ralph M. McInerny")
        BookItem.SubItems.Add("Ralph McLnerny")
        ListView1.Items.Add(BookItem)


        BookItem = New ListViewItem()
        BookItem.Text = "0791448940"
        BookItem.SubItems.Add("Nature, Design, and Science : The Status of Design in Natural Science (Suny Series in Philosophy and Biology) ")
        BookItem.SubItems.Add("Del Ratzsch")
        ListView1.Items.Add(BookItem)


        BookItem = New ListViewItem()
        BookItem.Text = "1861002750"
        BookItem.SubItems.Add("Professional ADO 2.5 Programming (Wrox Professional Guide)")
        BookItem.SubItems.Add("David Sussman")
        BookItem.SubItems.Add("James Conard")
        BookItem.SubItems.Add("Brian Matsik")
        BookItem.SubItems.Add("Tim McCarthy")
        BookItem.SubItems.Add("John Papa")
        BookItem.SubItems.Add("Simon Robinson")
        BookItem.SubItems.Add("Ian Blackburn")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0782126103"
        BookItem.SubItems.Add("Networking Complete")
        BookItem.SubItems.Add("Pat Coleman ")
        BookItem.SubItems.Add("Christa Anderson")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0782122914"
        BookItem.SubItems.Add("MCSE Exam Notes: Networking Essentials")
        BookItem.SubItems.Add("Glenn Madow")
        BookItem.SubItems.Add("James Chellis")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0156445085"
        BookItem.SubItems.Add("In Search of the Miraculous : Fragments of an Unknown Teaching ")
        BookItem.SubItems.Add("P. D. Ouspensky")
        ListView1.Items.Add(BookItem)

        BookItem = New ListViewItem()
        BookItem.Text = "0472065211"
        BookItem.SubItems.Add("Simulacra and Simulation")
        BookItem.SubItems.Add("Jean Baudrillard")
        BookItem.SubItems.Add("Sheila Faria Glaser")
        ListView1.Items.Add(BookItem)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -