diff --git a/BIMAPI_HW2/BIMAPI_HW2.csproj b/BIMAPI_HW2/BIMAPI_HW2.csproj index 4ef6cb5..c831105 100644 --- a/BIMAPI_HW2/BIMAPI_HW2.csproj +++ b/BIMAPI_HW2/BIMAPI_HW2.csproj @@ -62,6 +62,7 @@ Resources.resx + diff --git a/BIMAPI_HW2/BIMAPI_HW2/Form1.Designer.cs b/BIMAPI_HW2/BIMAPI_HW2/Form1.Designer.cs index a9b6093..6b9b298 100644 --- a/BIMAPI_HW2/BIMAPI_HW2/Form1.Designer.cs +++ b/BIMAPI_HW2/BIMAPI_HW2/Form1.Designer.cs @@ -1,4 +1,6 @@  +using BIMAPI_HW2; + namespace BIMAPI_HW2 { partial class Form1 @@ -32,20 +34,20 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.maskedTextBox1 = new System.Windows.Forms.MaskedTextBox(); - this.maskedTextBox2 = new System.Windows.Forms.MaskedTextBox(); - this.button2 = new System.Windows.Forms.Button(); - this.checkBox1 = new System.Windows.Forms.CheckBox(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.button3 = new System.Windows.Forms.Button(); - this.button4 = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.label4 = new System.Windows.Forms.Label(); + this.label1 = FormControls.SetupLabel1(); + this.button1 = FormControls.SetupButton1(); + this.maskedTextBox1 = FormControls.SetupMaskedTextBox1(); + this.maskedTextBox2 = FormControls.SetupMaskedTextBox2(); + this.button2 = FormControls.SetupButton2(); + this.checkBox1 = FormControls.SetupCheckBox1(); + this.checkBox2 = FormControls.SetupCheckBox2(); + this.button3 = FormControls.SetupButton3(); + this.button4 = FormControls.SetupButton4(); + this.label2 = FormControls.SetupLabel2(); + this.label3 = FormControls.SetupLabel3(); + this.pictureBox1 = FormControls.SetupPictureBox1(); + this.dataGridView1 = FormControls.SetupDataGridView1(); + this.label4 = FormControls.SetupLabel4(); this.尺寸 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); diff --git a/BIMAPI_HW2/BIMAPI_HW2/FormControls.cs b/BIMAPI_HW2/BIMAPI_HW2/FormControls.cs new file mode 100644 index 0000000..bb940b4 --- /dev/null +++ b/BIMAPI_HW2/BIMAPI_HW2/FormControls.cs @@ -0,0 +1,45 @@ +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace BIMAPI_HW2 +{ + public class FormControls + { + public Label SetupLabel1() + { + Label label1 = new Label(); + label1.AutoSize = true; + label1.Font = new Font("Microsoft JhengHei", 14F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(136))); + label1.Location = new Point(30, 256); + label1.Margin = new Padding(8, 0, 8, 0); + label1.Name = "label1"; + label1.Size = new Size(150, 42); + label1.TabIndex = 0; + label1.Text = "選擇物件"; + return label1; + } + + public Button SetupButton1() + { + Button button1 = new Button(); + button1.Font = new Font("Microsoft JhengHei", 12F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(136))); + button1.Location = new Point(948, 342); + button1.Margin = new Padding(8, 6, 8, 6); + button1.Name = "button1"; + button1.Size = new Size(60, 45); + button1.TabIndex = 2; + button1.Text = "..."; + button1.UseVisualStyleBackColor = true; + button1.Click += new EventHandler(button1_Click); + return button1; + } + + // Similar functions for maskedTextBox1, maskedTextBox2, button2, checkBox1, checkBox2, button3, button4, label2, label3, pictureBox1, dataGridView1, and label4 + + private void button1_Click(object sender, EventArgs e) + { + // Event handler code here + } + } +}