📄 frmseating.vb
字号:
'
' Chapter 02 - Completed Solution
'
' MCSD Guide to Developing Desktop Applications
' with Microsoft Visual Basic .NET
'
' Copyright (C) 2004 Course Technology
' All rights reserved.
Option Explicit On
Option Strict On
Public Class frmSeating
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New(ByVal AircraftType As String, ByVal pstrOrigin As String, ByVal pstrDestination As String)
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
Call ConfigureSeating(AircraftType)
lblOrigin.Text = pstrOrigin
lblDestination.Text = pstrDestination
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.
Friend WithEvents btnClose As System.Windows.Forms.Button
Friend WithEvents lblFull As System.Windows.Forms.Label
Friend WithEvents lblEmpty As System.Windows.Forms.Label
Friend WithEvents pnlSeats As System.Windows.Forms.Panel
Friend WithEvents lblPromptFull As System.Windows.Forms.Label
Friend WithEvents lblPromptEmpty As System.Windows.Forms.Label
Friend WithEvents btnClear As System.Windows.Forms.Button
Friend WithEvents lblOrigin As System.Windows.Forms.Label
Friend WithEvents lblDestination As System.Windows.Forms.Label
Friend WithEvents lblPromptOrigin As System.Windows.Forms.Label
Friend WithEvents lblPromptDestination As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.btnClose = New System.Windows.Forms.Button()
Me.lblFull = New System.Windows.Forms.Label()
Me.lblEmpty = New System.Windows.Forms.Label()
Me.pnlSeats = New System.Windows.Forms.Panel()
Me.lblPromptFull = New System.Windows.Forms.Label()
Me.lblPromptEmpty = New System.Windows.Forms.Label()
Me.btnClear = New System.Windows.Forms.Button()
Me.lblOrigin = New System.Windows.Forms.Label()
Me.lblDestination = New System.Windows.Forms.Label()
Me.lblPromptOrigin = New System.Windows.Forms.Label()
Me.lblPromptDestination = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'btnClose
'
Me.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnClose.Location = New System.Drawing.Point(192, 72)
Me.btnClose.Name = "btnClose"
Me.btnClose.Size = New System.Drawing.Size(72, 32)
Me.btnClose.TabIndex = 0
Me.btnClose.Text = "&Close"
'
'lblFull
'
Me.lblFull.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblFull.Location = New System.Drawing.Point(72, 16)
Me.lblFull.Name = "lblFull"
Me.lblFull.Size = New System.Drawing.Size(56, 16)
Me.lblFull.TabIndex = 1
'
'lblEmpty
'
Me.lblEmpty.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblEmpty.Location = New System.Drawing.Point(72, 40)
Me.lblEmpty.Name = "lblEmpty"
Me.lblEmpty.Size = New System.Drawing.Size(56, 16)
Me.lblEmpty.TabIndex = 2
'
'pnlSeats
'
Me.pnlSeats.AutoScroll = True
Me.pnlSeats.Dock = System.Windows.Forms.DockStyle.Bottom
Me.pnlSeats.Location = New System.Drawing.Point(0, 133)
Me.pnlSeats.Name = "pnlSeats"
Me.pnlSeats.Size = New System.Drawing.Size(288, 376)
Me.pnlSeats.TabIndex = 3
'
'lblPromptFull
'
Me.lblPromptFull.Location = New System.Drawing.Point(16, 16)
Me.lblPromptFull.Name = "lblPromptFull"
Me.lblPromptFull.Size = New System.Drawing.Size(56, 16)
Me.lblPromptFull.TabIndex = 4
Me.lblPromptFull.Text = "Full"
Me.lblPromptFull.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblPromptEmpty
'
Me.lblPromptEmpty.Location = New System.Drawing.Point(16, 40)
Me.lblPromptEmpty.Name = "lblPromptEmpty"
Me.lblPromptEmpty.Size = New System.Drawing.Size(56, 16)
Me.lblPromptEmpty.TabIndex = 5
Me.lblPromptEmpty.Text = "Empty"
Me.lblPromptEmpty.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'btnClear
'
Me.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnClear.Location = New System.Drawing.Point(192, 32)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(72, 32)
Me.btnClear.TabIndex = 6
Me.btnClear.Text = "C&lear"
'
'lblOrigin
'
Me.lblOrigin.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblOrigin.Location = New System.Drawing.Point(72, 64)
Me.lblOrigin.Name = "lblOrigin"
Me.lblOrigin.Size = New System.Drawing.Size(104, 16)
Me.lblOrigin.TabIndex = 7
'
'lblDestination
'
Me.lblDestination.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.lblDestination.Location = New System.Drawing.Point(72, 88)
Me.lblDestination.Name = "lblDestination"
Me.lblDestination.Size = New System.Drawing.Size(104, 16)
Me.lblDestination.TabIndex = 8
'
'lblPromptOrigin
'
Me.lblPromptOrigin.Location = New System.Drawing.Point(16, 64)
Me.lblPromptOrigin.Name = "lblPromptOrigin"
Me.lblPromptOrigin.Size = New System.Drawing.Size(56, 16)
Me.lblPromptOrigin.TabIndex = 9
Me.lblPromptOrigin.Text = "Origin"
Me.lblPromptOrigin.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'lblPromptDestination
'
Me.lblPromptDestination.Location = New System.Drawing.Point(8, 88)
Me.lblPromptDestination.Name = "lblPromptDestination"
Me.lblPromptDestination.Size = New System.Drawing.Size(64, 16)
Me.lblPromptDestination.TabIndex = 10
Me.lblPromptDestination.Text = "Destination"
Me.lblPromptDestination.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'frmSeating
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.AutoScroll = True
Me.ClientSize = New System.Drawing.Size(288, 509)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblPromptDestination, Me.lblPromptOrigin, Me.lblDestination, Me.lblOrigin, Me.btnClear, Me.lblPromptEmpty, Me.lblPromptFull, Me.pnlSeats, Me.lblEmpty, Me.lblFull, Me.btnClose})
Me.Name = "frmSeating"
Me.Text = "Seating Chart"
Me.ResumeLayout(False)
End Sub
#End Region
' Delcare two dynamic arrays to store the created CheckBox and Label
' control instances. The array named chkSeats is a 2-dimensional array
' and the array lblRow is a one dimensional array.
Private chkSeats(,) As System.Windows.Forms.CheckBox
Private lblRow() As System.Windows.Forms.Label
' The following constants improve readibility by defining the
' standard size of each check box, and the number of seats and rows
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -