child.vb

来自「Samples are organized by chapter, and th」· VB 代码 · 共 81 行

VB
81
字号
Public Class Child
    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.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

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

    '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()
        '
        'Child
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 14)
        Me.ClientSize = New System.Drawing.Size(448, 226)
        Me.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Name = "Child"
        Me.Text = "MDI Child"

    End Sub

#End Region


    Enum ViewType
        ItemGrid
        PrintPreview
    End Enum

    Public Document As Order
    Public Sub New(ByVal doc As Order, ByVal viewType As ViewType)
        ' This is required to make sure the controls that were added at
        ' design-time are actually rendered.
        Me.New()

        ' Configure the title.
        Me.Text = doc.LastFileName
        Me.Document = doc

        ' Create a reference for the view.
        ' This reference can accomodate any type of control.
        Dim View As Control

        ' Instantiate the appropriate view.
        Select Case viewType
            Case viewType.ItemGrid
                View = New OrderGridView(doc)
            Case viewType.PrintPreview
                View = New OrderPrintPreview(doc)
        End Select

        ' Add the view to the form.
        View.Dock = DockStyle.Fill
        Me.Controls.Add(View)
    End Sub


End Class

⌨️ 快捷键说明

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