瀏覽代碼

修改图标位置

章政 8 年之前
父節點
當前提交
65eb5659ba

+ 25 - 26
UAS-MES/CustomControl/TextBoxWithIcon/TextBoxWithTextArea.Designer.cs

@@ -28,51 +28,50 @@
         /// </summary>
         private void InitializeComponent()
         {
-            this.textBox1 = new UAS_MES.CustomControl.TextBoxWithIcon.MaCodeTextBox();
+            this.TextAreaTextBox = new UAS_MES.CustomControl.TextBoxWithIcon.MaCodeTextBox();
             this.TextAreaIcon = new System.Windows.Forms.PictureBox();
             ((System.ComponentModel.ISupportInitialize)(this.TextAreaIcon)).BeginInit();
             this.SuspendLayout();
             // 
-            // textBox1
+            // TextAreaTextBox
             // 
-            this.textBox1.AllPower = null;
-            this.textBox1.BackColor = System.Drawing.Color.White;
-            this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.textBox1.ID = null;
-            this.textBox1.Location = new System.Drawing.Point(0, 0);
-            this.textBox1.Lock = false;
-            this.textBox1.Margin = new System.Windows.Forms.Padding(4);
-            this.textBox1.Name = "textBox1";
-            this.textBox1.Power = null;
-            this.textBox1.Size = new System.Drawing.Size(265, 25);
-            this.textBox1.Str = null;
-            this.textBox1.Str1 = null;
-            this.textBox1.Str2 = null;
-            this.textBox1.TabIndex = 0;
-            this.textBox1.Enter += new System.EventHandler(this.textBox1_Enter);
-            this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave);
+            this.TextAreaTextBox.AllPower = null;
+            this.TextAreaTextBox.BackColor = System.Drawing.Color.White;
+            this.TextAreaTextBox.Dock = System.Windows.Forms.DockStyle.Left;
+            this.TextAreaTextBox.ID = null;
+            this.TextAreaTextBox.Location = new System.Drawing.Point(0, 0);
+            this.TextAreaTextBox.Lock = false;
+            this.TextAreaTextBox.Name = "TextAreaTextBox";
+            this.TextAreaTextBox.Power = null;
+            this.TextAreaTextBox.Size = new System.Drawing.Size(173, 21);
+            this.TextAreaTextBox.Str = null;
+            this.TextAreaTextBox.Str1 = null;
+            this.TextAreaTextBox.Str2 = null;
+            this.TextAreaTextBox.TabIndex = 0;
+            this.TextAreaTextBox.Enter += new System.EventHandler(this.textBox1_Enter);
+            this.TextAreaTextBox.Leave += new System.EventHandler(this.textBox1_Leave);
             // 
             // TextAreaIcon
             // 
             this.TextAreaIcon.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.TextAreaIcon.Dock = System.Windows.Forms.DockStyle.Right;
             this.TextAreaIcon.Image = global::UAS_MES.Properties.Resources.notice_text_editor_16px_11373_easyicon_net;
-            this.TextAreaIcon.Location = new System.Drawing.Point(239, 1);
-            this.TextAreaIcon.Margin = new System.Windows.Forms.Padding(4);
+            this.TextAreaIcon.Location = new System.Drawing.Point(174, 0);
             this.TextAreaIcon.Name = "TextAreaIcon";
-            this.TextAreaIcon.Size = new System.Drawing.Size(25, 21);
+            this.TextAreaIcon.Size = new System.Drawing.Size(19, 21);
             this.TextAreaIcon.TabIndex = 1;
             this.TextAreaIcon.TabStop = false;
             this.TextAreaIcon.Click += new System.EventHandler(this.TextAreaIcon_Click);
             // 
             // TextBoxWithTextArea
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.TextAreaIcon);
-            this.Controls.Add(this.textBox1);
-            this.Margin = new System.Windows.Forms.Padding(4);
+            this.Controls.Add(this.TextAreaTextBox);
             this.Name = "TextBoxWithTextArea";
-            this.Size = new System.Drawing.Size(265, 25);
+            this.Size = new System.Drawing.Size(193, 21);
+            this.SizeChanged += new System.EventHandler(this.TextBoxWithTextArea_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.TextAreaIcon)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
@@ -81,7 +80,7 @@
 
         #endregion
 
-        private CustomControl.TextBoxWithIcon.MaCodeTextBox textBox1;
+        private CustomControl.TextBoxWithIcon.MaCodeTextBox TextAreaTextBox;
         private System.Windows.Forms.PictureBox TextAreaIcon;
     }
 }

+ 9 - 4
UAS-MES/CustomControl/TextBoxWithIcon/TextBoxWithTextArea.cs

@@ -16,11 +16,11 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
         {
             get
             {
-                return textBox1.Text;
+                return TextAreaTextBox.Text;
             }
             set
             {
-                textBox1.Text = value;
+                TextAreaTextBox.Text = value;
             }
         }
 
@@ -68,12 +68,17 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
 
         private void textBox1_Leave(object sender, EventArgs e)
         {
-            textBox1.BackColor = Color.White;
+            TextAreaTextBox.BackColor = Color.White;
         }
 
         private void textBox1_Enter(object sender, EventArgs e)
         {
-            textBox1.BackColor = Color.GreenYellow;
+            TextAreaTextBox.BackColor = Color.GreenYellow;
+        }
+
+        private void TextBoxWithTextArea_SizeChanged(object sender, EventArgs e)
+        {
+            TextAreaTextBox.Width = this.Width - TextAreaIcon.Width - 3;
         }
     }
 }