Download presentation
Presentation is loading. Please wait.
Published byBaldwin Evan Henry Modified over 9 years ago
1
計算機程式及實習 課堂作業之口頭報告 題目:商店結帳系統 南台科技大學 機械工程系 奈米一乙 學號: 49914025 學生:李昀叡
2
商店結帳系統說明: 在右方框裡輸入餐點數量,之後選擇打折數 點選試算後即可得知總金額 點選清除則可清除方框內數量
3
表單設計:設置輸出入介面 表單標題 Label1 Label7 Label2 Label3 Label4 Label5 RadioButton1 Button1 TextBox1 TextBox2 TextBox3 TextBox4 RadioButton3 Button2 Label6
4
程式碼撰寫 _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form 覆寫 Dispose 以清除元件清單。 _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub
5
' 為 Windows Form 設計工具的必要項 Private components As System.ComponentModel.IContainer ' 注意 : 以下為 Windows Form 設計工具所 需的程序 ' 可以使用 Windows Form 設計工具進行修 改。 ‘ 請不要使用程式碼編輯器進行修改。 _
6
Private Sub InitializeComponent() Me.Label1 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.Label4 = New System.Windows.Forms.Label Me.Label5 = New System.Windows.Forms.Label Me.TextBox1 = New System.Windows.Forms.TextBox Me.TextBox2 = New System.Windows.Forms.TextBox Me.TextBox3 = New System.Windows.Forms.TextBox Me.TextBox4 = New System.Windows.Forms.TextBox Me.Button1 = New System.Windows.Forms.Button Me.Button2 = New System.Windows.Forms.Button Me.Label6 = New System.Windows.Forms.Label Me.Label7 = New System.Windows.Forms.Label Me.RadioButton1 = New System.Windows.Forms.RadioButton Me.RadioButton2 = New System.Windows.Forms.RadioButton Me.RadioButton3 = New System.Windows.Forms.RadioButton Me.SuspendLayout()
7
'Label1 ' Me.Label1.AutoSize = True Me.Label1.Font = New System.Drawing.Font(" 華康娃娃體 ", 72.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label1.ForeColor = System.Drawing.Color.Red Me.Label1.Location = New System.Drawing.Point(53, 49) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(525, 96) Me.Label1.TabIndex = 0 Me.Label1.Text = " 破爛餐廳 " ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.BackColor = System.Drawing.Color.Black Me.Label2.Font = New System.Drawing.Font(" 華康娃娃體 ", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label2.ForeColor = System.Drawing.Color.White Me.Label2.Location = New System.Drawing.Point(64, 177) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(460, 27) Me.Label2.TabIndex = 1 Me.Label2.Text = " 特餐...................500"
8
'Label3 ' Me.Label3.AutoSize = True Me.Label3.BackColor = System.Drawing.Color.Black Me.Label3.Font = New System.Drawing.Font(" 華康娃娃體 ", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label3.ForeColor = System.Drawing.Color.White Me.Label3.Location = New System.Drawing.Point(64, 243) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(460, 27) Me.Label3.TabIndex = 1 Me.Label3.Text = " 簡餐...................300" ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.BackColor = System.Drawing.Color.Black Me.Label4.Font = New System.Drawing.Font(" 華康娃娃體 ", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label4.ForeColor = System.Drawing.Color.White Me.Label4.Location = New System.Drawing.Point(64, 310) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(460, 27) Me.Label4.TabIndex = 1 Me.Label4.Text = " 兒童餐.................250"
9
'Label5 ' Me.Label5.AutoSize = True Me.Label5.BackColor = System.Drawing.Color.Black Me.Label5.Font = New System.Drawing.Font(" 華康娃娃體 ", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label5.ForeColor = System.Drawing.Color.White Me.Label5.Location = New System.Drawing.Point(64, 380) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(460, 27) Me.Label5.TabIndex = 1 Me.Label5.Text = " 輕鬆餐.................200" ' 'TextBox1 ' Me.TextBox1.AllowDrop = True Me.TextBox1.Location = New System.Drawing.Point(549, 182) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(60, 22) Me.TextBox1.TabIndex = 2
10
'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(549, 248) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(60, 22) Me.TextBox2.TabIndex = 3 ' 'TextBox3 ' Me.TextBox3.Location = New System.Drawing.Point(549, 315) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(60, 22) Me.TextBox3.TabIndex = 4 '
11
'TextBox4 ' Me.TextBox4.Location = New System.Drawing.Point(549, 385) Me.TextBox4.Name = "TextBox4" Me.TextBox4.Size = New System.Drawing.Size(60, 22) Me.TextBox4.TabIndex = 4 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(69, 501) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(118, 31) Me.Button1.TabIndex = 5 Me.Button1.Text = " 試算 " Me.Button1.UseVisualStyleBackColor = True
12
'Button2 ' Me.Button2.Location = New System.Drawing.Point(219, 501) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(118, 31) Me.Button2.TabIndex = 5 Me.Button2.Text = " 清除 " Me.Button2.UseVisualStyleBackColor = True ' 'Label6 ' Me.Label6.AutoSize = True Me.Label6.Font = New System.Drawing.Font(" 華康娃娃體 ", 36.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label6.ForeColor = System.Drawing.Color.White Me.Label6.Location = New System.Drawing.Point(343, 460) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(0, 48) Me.Label6.TabIndex = 6
13
'Label7 ' Me.Label7.AutoSize = True Me.Label7.Font = New System.Drawing.Font(" 華康娃娃體 ", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.Label7.ForeColor = System.Drawing.Color.White Me.Label7.Location = New System.Drawing.Point(555, 145) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(54, 21) Me.Label7.TabIndex = 7 Me.Label7.Text = " 數量 " ' 'RadioButton1 ' Me.RadioButton1.AutoSize = True Me.RadioButton1.Font = New System.Drawing.Font(" 華康娃娃體 ", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.RadioButton1.ForeColor = System.Drawing.Color.White Me.RadioButton1.Location = New System.Drawing.Point(69, 433) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.Size = New System.Drawing.Size(63, 25) Me.RadioButton1.TabIndex = 8 Me.RadioButton1.TabStop = True Me.RadioButton1.Text = "9 折 " Me.RadioButton1.UseVisualStyleBackColor = True
14
'RadioButton2 ' Me.RadioButton2.AutoSize = True Me.RadioButton2.Location = New System.Drawing.Point(219, 433) Me.RadioButton2.Name = "RadioButton2" Me.RadioButton2.Size = New System.Drawing.Size(89, 16) Me.RadioButton2.TabIndex = 8 Me.RadioButton2.TabStop = True Me.RadioButton2.Text = "RadioButton1" Me.RadioButton2.UseVisualStyleBackColor = True ' 'RadioButton3 ' Me.RadioButton3.AutoSize = True Me.RadioButton3.Font = New System.Drawing.Font(" 華康娃娃體 ", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(136, Byte)) Me.RadioButton3.ForeColor = System.Drawing.Color.White Me.RadioButton3.Location = New System.Drawing.Point(219, 433) Me.RadioButton3.Name = "RadioButton3" Me.RadioButton3.Size = New System.Drawing.Size(63, 25) Me.RadioButton3.TabIndex = 8 Me.RadioButton3.TabStop = True Me.RadioButton3.Text = "8 折 " Me.RadioButton3.UseVisualStyleBackColor = True
15
'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.BackColor = System.Drawing.Color.Black Me.ClientSize = New System.Drawing.Size(633, 585) Me.Controls.Add(Me.RadioButton3) Me.Controls.Add(Me.RadioButton2) Me.Controls.Add(Me.RadioButton1) Me.Controls.Add(Me.Label7) Me.Controls.Add(Me.Label6) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox4) Me.Controls.Add(Me.TextBox3) Me.Controls.Add(Me.TextBox2) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) Me.PerformLayout() End Sub
16
Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton End Class
17
執行程式 1. 輸入餐點數 量 2. 選擇所需打 折數 3. 執行試算按 鈕 4. 執行清除按 鈕
18
選點九折試算後結果點選八折試算後結果
19
心得 以前從未碰過 Visual Basic2008 這個東西 但是學了之後覺得很好玩,只是有些地方 還是很難,複雜的地方就努力和同學討論, 我們也能做一些簡單的程式,讓我們學了 不少東西,很充實很有趣。 Visual Basic2008 真是個不錯東西 !!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.