# 物件導向程式設計實習 ## 2024/1/24 ### 1.Hello World - C# 互動式 C# 教學課程簡介 ![1](https://hackmd.io/_uploads/Hkg2UX0F6.png) ### 2.在 C# 中操作整數和浮點數數字 ![2](https://hackmd.io/_uploads/H1N2I70Ka.png) ### 3.透過分支和迴圈陳述式了解條件式邏輯 ![3](https://hackmd.io/_uploads/rJO3IQCtT.png) ### 4.了解如何使用一般清單類型管理資料收集 ![4](https://hackmd.io/_uploads/H1n2LX0YT.png) ### 心得 在第一堂物件導向程式設計實習課程中我學到了新的程式語言(c語言), c語言和他的兄弟(c++)不只名子相似,程式邏輯也差不多,但是有些語法不太相同, 像是在(c++)中要讓程式輸出要輸入(cout>>"hello world";) 在c語言中則是(Console.WriteLine("hello world");) 補充line是換行的意思類似c++中的endl ## 2024/2/21 ### 練習1 ``` // See https://aka.ms/new-console-template for more information Console.Write("請輸入你的名字:"); string name = Console.ReadLine(); Console.WriteLine($"Good Day!{name}"); ``` ![image](https://hackmd.io/_uploads/HkB4tAMna.png) ### 練習2 ``` // See https://aka.ms/new-console-template for more information Console.Write("請輸入名稱:"); string? name = Console.ReadLine(); Console.Write("請輸入提款金額:"); int money = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Hi! {name}, 提款金額:{money:C0}"); ``` ![image](https://hackmd.io/_uploads/BkmFykQ36.png) ### 練習3 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace s1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { label1.Text = "確定沒問題"; } private void button2_Click(object sender, EventArgs e) { label1.Text = string.Empty; } private void button3_Click(object sender, EventArgs e) { label1.Text = DateTime.Now.ToString(); } private void button4_Click(object sender, EventArgs e) { label1.Text = "hello"; } } } ``` ![image](https://hackmd.io/_uploads/Byrh0yX2p.png) ![image](https://hackmd.io/_uploads/rJi6RkX3T.png) ### 課堂作業1 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace s1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { label1.Text = "確定沒問題"; pictureBox1.Image = Properties.Resources.fubuki03; } private void button2_Click(object sender, EventArgs e) { label1.Text = string.Empty; } private void button3_Click(object sender, EventArgs e) { label1.Text = DateTime.Now.ToString(); pictureBox1.Image = Properties.Resources.fubuki02; } private void button4_Click(object sender, EventArgs e) { label1.Text = "hello"; pictureBox1.Image = Properties.Resources.fubuki01; } } } ``` ![image](https://hackmd.io/_uploads/r1kFee73a.png) ![image](https://hackmd.io/_uploads/S1otggmhT.png) ![image](https://hackmd.io/_uploads/ByB9geQ2p.png) ![image](https://hackmd.io/_uploads/H1yslgXh6.png) ## 2024/3/6 ### 練習1 ``` using static System.Console; WriteLine("資訊一甲 13 林葳明"); WriteLine(" "); int num1 = 1_23_456; long num2 = 465_879_456L; long max = Int64.MaxValue; long min = Int64.MinValue; int num3 = 0b1011_110; int num4 = 0b_111_110_10; int num5 = 0x_FB12; WriteLine($"Number:{num1:n0},{num2:n0}"); WriteLine($"2進-10進:{num3:D5},{num4:D4},{num5:D6}"); WriteLine($".NET Farmework(num1):{num1.GetType()}"); WriteLine($".NET Farmework(num2):{num2.GetType()}"); WriteLine($"MAX:{max}"); WriteLine($"MIN:{min}"); ``` ![image](https://hackmd.io/_uploads/S17euFHpa.png) ### 練習2 ``` using static System.Console; WriteLine("資訊一甲 13 林葳明"); WriteLine(" "); float num1 = 1.2233445566778899F; double num2 = 1.2233445566778899; decimal num3 = 1.2233445566778899M; double x1 = 0.1, x2 = 0.2; decimal y1 = 0.1M, y2 = 0.2M; WriteLine($"float: {num1}"); WriteLine($"double: {num2}"); WriteLine($"decimal: {num3}"); WriteLine($"float: {num1:f4}"); WriteLine($"double佔< { sizeof(double)} >位元組"); WriteLine($"decimal佔< {sizeof(decimal)} >位元組"); ``` ![image](https://hackmd.io/_uploads/H1_l2KSpp.png) ### 練習3 ``` using static System.Console; WriteLine("資訊一甲 13 林葳明"); WriteLine(" "); const float sq = 3.0579F; Write("請輸入坪數"); float a = Convert.ToSingle(ReadLine()); WriteLine($"{a}坪 = {sq*a}平方公尺"); const float p = 3.14159F; const float c = p * 25.0F; WriteLine($"圓面積 ->{c}"); ``` ![image](https://hackmd.io/_uploads/H1OCaYSpp.png) ### 練習4 ``` using static System.Console; WriteLine("資訊一甲 13 林葳明"); WriteLine(" "); Write("請輸入生日"); string bir = ReadLine(); DateTime special = Convert.ToDateTime(bir); DateTime Atonce = DateTime.Now; string thisday = Convert.ToString(Atonce); WriteLine($"今天是{thisday} /n 你的生日 {special}"); ``` ![image](https://hackmd.io/_uploads/ry15k5B6p.png) ### 作業 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { } private void button1_Click_1(object sender, EventArgs e) { try { int loan, year, money, month; double rate, payrate, mrate; loan = int.Parse(textBox1.Text); rate = int.Parse(textBox4.Text)/100.0; year = int.Parse(textBox3.Text); mrate = rate / 12; month = year * 12; payrate = ((Math.Pow((1 + rate / 12), year * 12) * rate / 12)) / (Math.Pow((1 + rate / 12), year * 12) - 1); money = (int)(loan*payrate +0.5); label6.Text = money.ToString(); } catch { label6.Text = "Error"; } } private void button2_Click(object sender, EventArgs e) { textBox1.Text = " "; label6.Text = " "; textBox3.Text = " "; textBox4.Text = " "; } } } ``` ![image](https://hackmd.io/_uploads/S1T6GsB66.png) ## 2024/3/13 ### 練習1 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { textBox1.MaxLength = 3; textBox2.ReadOnly = true; } private void button1_Click(object sender, EventArgs e) { try { double C = Convert.ToDouble(textBox1.Text); double F = C * 9 / 5 + 32; textBox2.Text = F.ToString(); } catch { textBox2.Text = "Please enter the value"; textBox2.Clear(); } } } } ``` ![image](https://hackmd.io/_uploads/S1gwZqRTa.png) ### 練習2 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string n = Microsoft.VisualBasic.Interaction.InputBox("請輸入姓名", "輸入"); DialogResult dr = MessageBox.Show(n+"歡迎你","歡迎",MessageBoxButtons.OK,MessageBoxIcon.Asterisk); Text = n; } private void button1_Click(object sender, EventArgs e) { try { int i = Convert.ToInt32(textBox2.Text); label4.Text = $"提款金額 :{i:N} 元"; } catch { MessageBox.Show("請輸入整數","注意", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } ``` ![image](https://hackmd.io/_uploads/ryHZi5RT6.png) ### 作業 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { string n = Microsoft.VisualBasic.Interaction.InputBox("請輸入姓名", "輸入"); DialogResult dr = MessageBox.Show(n+"歡迎你","歡迎",MessageBoxButtons.OK,MessageBoxIcon.Asterisk); Text = n; } private void button1_Click(object sender, EventArgs e) { float[] score = new float[] { Convert.ToSingle(textBox1.Text), Convert.ToSingle(textBox2.Text), Convert.ToSingle(textBox3.Text), Convert.ToSingle(textBox4.Text), Convert.ToSingle(textBox5.Text) }; float sum = 0.0F; int len = score.Length; float max = 97; string top = string.Empty; for (int i = 0; i < score.Length; i++) { sum += score[i]; if (score[i] > max) max = score[i]; } float avg = sum / (float)len; label6.Text = "總分= "+sum.ToString(); label7.Text = "平均= "+avg.ToString(); label8.Text = "最高= "+max.ToString(); } } } ``` ![image](https://hackmd.io/_uploads/r1mzQoA6p.png) ## 2024/3/20 ### 題目1 ``` using static System.Console; int sum = 0, count = 0; for (; ;) { Write("請輸入數值"); int num = Convert.ToInt32(Console.ReadLine()); count += 1; sum += num; Write("繼續嗎(y繼續)"); string? endkey = ReadLine(); if (endkey != "y") break; } WriteLine($"輸入{count}個數值合計{sum}") ``` ![image](https://hackmd.io/_uploads/SkSFdlORp.png) ### 作業 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Text; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string idChar = "abcdefghijklmopqrstuvwxyz"; string[] idCity = {"台北市","台中市","基隆市","台南市","高雄市","新北市","宜蘭縣","桃園縣", "新竹縣","苗栗國","台中市","南投縣","彰化縣","雲林縣","嘉義縣","台南市","高雄市", "屏東縣","花蓮國","台東縣","澎湖縣","陽明山","金門縣","連江縣","嘉義市","新竹市"}; string msg = ""; string id, gender; Random r = new Random(); private void button2_Click(object sender, EventArgs e) { int sum = 0,idPos = 0; idPos = r.Next(26); id = idChar.Substring(idPos,1).ToUpper(); sum = (idPos + 10) / 10 + (idPos % 10) * 9; idPos = r.Next(2) + 1; id += idPos.ToString(); sum += idPos * 8; for(int i = 2; i < 9; i++) { idPos = r.Next(10); id += idPos.ToString(); sum += idPos * (9-i); } if (sum % 10 == 0) idPos = 0; else idPos = 10-(sum%10); id += idPos.ToString(); sum += idPos; textBox1.Text = id; } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { if (textBox1.Text.Trim().Length == 10) { int sum = 0, idPos = 0; id = textBox1.Text; idPos = idChar.IndexOf(id.Substring(0, 1).ToLower()); sum = ((idPos + 10) / 10 + (idPos % 10) * 9)%10; gender = id.Substring(1, 1); for (int i = 1; i < 9; i++) sum += Convert.ToInt32(id.Substring(i, 1)) * (9 - i); //sum += Convert.ToInt32(id.Substring(1, 1)); if ((10-(sum % 10))%10 == Convert.ToInt32(id.Substring(9,1))) msg = sum.ToString() + ",正確," + idCity[idPos]; else msg = sum.ToString() + "錯誤"; if (gender == "1") msg += " 男"; else msg += " 女"; } else msg = "錯誤"; label3.Text = msg; } } } ``` ![image](https://hackmd.io/_uploads/Skat7bOAT.png) ![image](https://hackmd.io/_uploads/Sk1oXWOAT.png) ## 2024/3/27 ### 練習1 ``` Console.WriteLine("資訊一甲 13 林葳明"); Console.WriteLine(" "); string[] name = { "Molly", "Eric", "Johseph", "Peter", "Iorn", "Priyanka" }; int[] age = { 24, 26, 24, 26, 28, 25 }; int index = Array.IndexOf(age, 24); Console.WriteLine("---年齡符合24歲---\n"); while (index >= 0) { Console.Write($"{name[index],-8}"); index = Array.IndexOf(age, 24,index +1); } Array.Sort(age); var key = Array.BinarySearch(age, 25); switch (key) { case >= 0: Console.WriteLine($"\n找到年齡25 ! 位置 = {key}"); break; default: Console.WriteLine($"\n未找到年齡25 ! 位置 = {key}"); break; } ``` ![image](https://hackmd.io/_uploads/S1zuolb1C.png) ### 練習2 ``` Console.WriteLine("資訊一甲 13 林葳明"); Console.WriteLine(" "); int outer, inner; int[] sum = new int[3]; string[] name = { "Marry", "Tori", "John" }; foreach (string item in name) Console.Write("{0,7}",item); Console.WriteLine(); int[,] score = { { 75, 65, 96 }, { 55, 67, 39 }, { 45, 92, 85 }, { 71, 69, 81 } }; int row = score.GetLength(0); int column = score.GetLength(1); for (outer = 0; outer < row; outer++) { for (inner = 0; inner < column; inner++) Console.Write($"{score[outer, inner],7}"); Console.WriteLine(); sum[0] += score[outer, 0]; sum[1] += score[outer, 1]; sum[2] += score[outer, 2]; } Console.WriteLine("-----------------------"); Console.WriteLine($"sum:{sum[0]} {sum[1],5}{sum[2],6}"); ``` ![image](https://hackmd.io/_uploads/rybfy-WJC.png) ### 練習3 ``` Console.WriteLine("資訊一甲 13 林葳明"); Console.WriteLine(" "); int[,,] num3D = new int[2,2,3] { { { 11,13,15},{ 22,24,26} },{ { 33,38,41},{ 44,48,52} } }; Console.Write($"元素:{num3D[1, 1, 1]}," + $"位於第2個表格,位於第2列 第2欄\n"); int table = num3D.GetLength(0); int row = num3D.GetLength(1); int column = num3D.GetLength(2); Console.Write($"表格{table} 個,二維表格{row}*{column}\n"); for (int i = 0; i < table; i++) { Console.WriteLine($"----表格{i + 1}----"); for (int j = 0; j < row; j++) { for (int k = 0; k < column; k++) Console.Write($"{num3D[i, j, k],3} |"); Console.WriteLine(); } Console.WriteLine(); } ``` ![image](https://hackmd.io/_uploads/SyJdM--kR.png) ### 作業1 ``` using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { int total; string msg; total = checkBox1.Checked == true ? 150 : 100; msg = checkBox1.Checked == true ? "大" : "小"; msg += "碗拉麵\n湯頭濃度:"; msg += checkBox3.Checked ? "濃郁" : checkBox4.Checked ? "適中" : "清淡;"; if (checkBox3.Checked == true) { total += 20; msg += "\n加點飲料"; } if (checkBox4.Checked == true) { total += 20; msg += "\n加點糖心蛋"; } msg += $"\n總價:{total}元"; MessageBox.Show(msg,"點菜單",MessageBoxButtons.OK, MessageBoxIcon.None); } } } ``` ![image](https://hackmd.io/_uploads/SythcbZyC.png) ## 2024/4/10 ### 練習1 ``` namespace WinFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Height = 90; pictureBox1.Width = 90; // 設定圖片高度和寬度 pictureBox1.Image = Image.FromFile("D:\\image\\pic1.jpg");// 載入圖檔 trackBar1.Maximum = 4; trackBar1.Minimum = 1;// 設定TkbPic的最大、最小值 vScrollBar1.Maximum = 180; vScrollBar1.Minimum = 1; // 設定最大、最小值 vScrollBar1.LargeChange = 1; // 設定VsbHeight的快動值 = 1 vScrollBar1.Value = pictureBox1.Height; // VsbHeight的Value值=圖片高度 hScrollBar1.Maximum = 180; hScrollBar1.Minimum = 1; // 設定最大、最小值 hScrollBar1.LargeChange = 1; // 設定HsbWidth的快動值 = 1 hScrollBar1.Value = pictureBox1.Width; // HsbWidth的Value值=圖片寬度 toolTip1.SetToolTip(vScrollBar1, $"{vScrollBar1.Value}"); toolTip1.SetToolTip(hScrollBar1, $"{hScrollBar1.Value}"); toolTip1.SetToolTip(trackBar1, "圖片1"); } private void vScrollBar1_Scroll(object sender, ScrollEventArgs e) { pictureBox1.Height = vScrollBar1.Value; toolTip1.SetToolTip(vScrollBar1, $"{vScrollBar1.Value}"); } private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) { pictureBox1.Width = hScrollBar1.Value; toolTip1.SetToolTip(hScrollBar1, $"{hScrollBar1.Value}"); } private void trackBar1_Scroll(object sender, EventArgs e) { pictureBox1.Image = Image.FromFile($"D:\\image\\pic {trackBar1.Value} .jpg"); toolTip1.SetToolTip(trackBar1, $"圖片{trackBar1.Value}"); } } } ``` ![image](https://hackmd.io/_uploads/Bkg055-7C.png) ### 練習2 ``` namespace WinFormsApp2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm"; dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.MinDate = DateTime.Now.AddMinutes(1); dateTimePicker1.MaxDate = DateTime.Now.AddDays(7); } private void button1_Click(object sender, EventArgs e) { timer1.Interval = 1000; timer1.Enabled = true; dateTimePicker1.Enabled = false; } private void timer1_Tick(object sender, EventArgs e) { if(DateTime.Now >= dateTimePicker1.Value) { timer1.Enabled = false; System.Media.SystemSounds.Beep.Play(); MessageBox.Show(textBox1.Text, "提示"); } } } } ``` ![image](https://hackmd.io/_uploads/BJz9eo-m0.png) ## 2024/4/17 ### 練習1 ``` using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { linkLabel1.LinkColor = Color.DarkOrchid; linkLabel1.ActiveLinkColor = Color.Yellow; linkLabel1.LinkVisited = true; linkLabel1.VisitedLinkColor = Color.Maroon; linkLabel1.LinkBehavior = LinkBehavior.HoverUnderline; linkLabel1.Text = "Visual Studio Web"; linkLabel1.LinkArea = new LinkArea(0, 6); } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Process.Start("https://www.visualstudio.com/"); } private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Process.Start("C:\\Users\\user\\source\\repos\\WindowsFormsApp2\\WindowsFormsApp2\\bin\\Debug\\WindowsFormsApp2.exe"); } } } ``` ![image](https://hackmd.io/_uploads/Sk2PBJal0.png) ![image](https://hackmd.io/_uploads/ryyqB16x0.png) #### 作業1 ``` { partial class Form1 { /// <summary> /// 設計工具所需的變數。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清除任何使用中的資源。 /// </summary> /// <param name="disposing">如果應該處置受控資源則為 true,否則為 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form 設計工具產生的程式碼 /// <summary> /// 此為設計工具支援所需的方法 - 請勿使用程式碼編輯器修改 /// 這個方法的內容。 /// </summary> private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.listCry = new System.Windows.Forms.ListBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.radAny = new System.Windows.Forms.RadioButton(); this.radGirl = new System.Windows.Forms.RadioButton(); this.radBoy = new System.Windows.Forms.RadioButton(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.txtNum = new System.Windows.Forms.TextBox(); this.btnGo = new System.Windows.Forms.Button(); this.btnSave = new System.Windows.Forms.Button(); this.txtBox = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.listCry); this.groupBox1.Location = new System.Drawing.Point(110, 51); this.groupBox1.Margin = new System.Windows.Forms.Padding(5); this.groupBox1.Name = "groupBox1"; this.groupBox1.Padding = new System.Windows.Forms.Padding(5); this.groupBox1.Size = new System.Drawing.Size(195, 182); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "縣市"; // // listCry // this.listCry.FormattingEnabled = true; this.listCry.ItemHeight = 19; this.listCry.Location = new System.Drawing.Point(9, 32); this.listCry.Name = "listCry"; this.listCry.Size = new System.Drawing.Size(178, 137); this.listCry.TabIndex = 0; this.listCry.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged); // // groupBox2 // this.groupBox2.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.groupBox2.Controls.Add(this.radAny); this.groupBox2.Controls.Add(this.radGirl); this.groupBox2.Controls.Add(this.radBoy); this.groupBox2.Location = new System.Drawing.Point(367, 49); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(254, 73); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "性別"; // // radAny // this.radAny.AutoSize = true; this.radAny.Location = new System.Drawing.Point(150, 41); this.radAny.Name = "radAny"; this.radAny.Size = new System.Drawing.Size(65, 23); this.radAny.TabIndex = 2; this.radAny.TabStop = true; this.radAny.Text = "任意"; this.radAny.UseVisualStyleBackColor = true; this.radAny.CheckedChanged += new System.EventHandler(this.radAny_CheckedChanged); // // radGirl // this.radGirl.AutoSize = true; this.radGirl.Location = new System.Drawing.Point(78, 41); this.radGirl.Name = "radGirl"; this.radGirl.Size = new System.Drawing.Size(65, 23); this.radGirl.TabIndex = 1; this.radGirl.TabStop = true; this.radGirl.Text = "女生"; this.radGirl.UseVisualStyleBackColor = true; this.radGirl.CheckedChanged += new System.EventHandler(this.radGirl_CheckedChanged); // // radBoy // this.radBoy.AutoSize = true; this.radBoy.Location = new System.Drawing.Point(7, 41); this.radBoy.Name = "radBoy"; this.radBoy.Size = new System.Drawing.Size(65, 23); this.radBoy.TabIndex = 0; this.radBoy.TabStop = true; this.radBoy.Text = "男生"; this.radBoy.UseVisualStyleBackColor = true; this.radBoy.CheckedChanged += new System.EventHandler(this.radBoy_CheckedChanged); // // groupBox3 // this.groupBox3.Controls.Add(this.txtNum); this.groupBox3.Location = new System.Drawing.Point(374, 146); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(247, 87); this.groupBox3.TabIndex = 4; this.groupBox3.TabStop = false; this.groupBox3.Text = "人數"; // // txtNum // this.txtNum.Location = new System.Drawing.Point(7, 44); this.txtNum.Name = "txtNum"; this.txtNum.Size = new System.Drawing.Size(234, 30); this.txtNum.TabIndex = 0; this.txtNum.TextChanged += new System.EventHandler(this.txtNum_TextChanged); // // btnGo // this.btnGo.Location = new System.Drawing.Point(119, 542); this.btnGo.Name = "btnGo"; this.btnGo.Size = new System.Drawing.Size(95, 49); this.btnGo.TabIndex = 6; this.btnGo.Text = "Go"; this.btnGo.UseVisualStyleBackColor = true; this.btnGo.Click += new System.EventHandler(this.btnGo_Click); // // btnSave // this.btnSave.Location = new System.Drawing.Point(350, 542); this.btnSave.Name = "btnSave"; this.btnSave.Size = new System.Drawing.Size(102, 49); this.btnSave.TabIndex = 7; this.btnSave.Text = "Save"; this.btnSave.UseVisualStyleBackColor = true; this.btnSave.Click += new System.EventHandler(this.btnSave_Click); // // txtBox // this.txtBox.Location = new System.Drawing.Point(115, 276); this.txtBox.Name = "txtBox"; this.txtBox.Size = new System.Drawing.Size(506, 229); this.txtBox.TabIndex = 8; this.txtBox.Text = "label1"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 19F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(766, 635); this.Controls.Add(this.txtBox); this.Controls.Add(this.btnSave); this.Controls.Add(this.btnGo); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.Font = new System.Drawing.Font("新細明體", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136))); this.Margin = new System.Windows.Forms.Padding(5); this.Name = "Form1"; this.Text = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.RadioButton radGirl; private System.Windows.Forms.RadioButton radBoy; private System.Windows.Forms.ListBox listCry; private System.Windows.Forms.RadioButton radAny; private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.TextBox txtNum; private System.Windows.Forms.Button btnGo; private System.Windows.Forms.Button btnSave; private System.Windows.Forms.Label txtBox; } } ``` ![image](https://hackmd.io/_uploads/H11HylTxR.png)