国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

控件屬性和InitializeComponent()關系:

2019-11-14 13:45:55
字體:
來源:轉載
供稿:網友
 1 namespace Test22 2 { 3     partial class Form1 4     { 5         /// <summary> 6         /// 必需的設計器變量。 7         /// </summary> 8         PRivate System.ComponentModel.IContainer components = null; 9 10         /// <summary>11         /// 清理所有正在使用的資源。12         /// </summary>13         /// <param name="disposing">如果應釋放托管資源,為 true;否則為 false。</param>14         protected override void Dispose(bool disposing)15         {16             if (disposing && (components != null))17             {18                 components.Dispose();19             }20             base.Dispose(disposing);21         }22 23         #region Windows 窗體設計器生成的代碼24 25         /// <summary>26         /// 設計器支持所需的方法 - 不要27         /// 使用代碼編輯器修改此方法的內容。28         /// </summary>29         private void InitializeComponent()30         {31             this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();32             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();33             this.SuspendLayout();34             // 35             // numericUpDown136             // 37             this.numericUpDown1.DecimalPlaces = 4;//屬性里對應!!!!!38             this.numericUpDown1.Location = new System.Drawing.Point(12, 12);39             this.numericUpDown1.Name = "numericUpDown1";40             this.numericUpDown1.Size = new System.Drawing.Size(120, 21);41             this.numericUpDown1.TabIndex = 0;42             // 43             // Form144             // 45             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);46             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;47             this.ClientSize = new System.Drawing.Size(153, 53);48             this.Controls.Add(this.numericUpDown1);49             this.Name = "Form1";50             this.Text = "Form1";51             this.Load += new System.EventHandler(this.Form1_Load);52             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();53             this.ResumeLayout(false);54 55         }56 57         #endregion58 59         private System.Windows.Forms.NumericUpDown numericUpDown1;60     }61 }

控件中小數點位數和InitializeComponent()里面的代碼相呼應,而下面的代碼又設置了2,所以覆蓋掉了,代碼和運行結果如下:

 1 using System; 2 using System.Data; 3 using System.Drawing; 4 using System.Text; 5 using System.Windows.Forms; 6 namespace Test22 7 { 8     public partial class Form1 : Form 9     {10         public Form1()11         {12             InitializeComponent();13         }14         private void Form1_Load(object sender, EventArgs e)15         {16             numericUpDown1.Maximum = 20;17             numericUpDown1.Minimum = 1;18             numericUpDown1.DecimalPlaces = 2;19         }20     }21 }

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 澎湖县| 建瓯市| 榆树市| 桃源县| 建瓯市| 特克斯县| 湟中县| 岢岚县| 乐清市| 确山县| 尚志市| 盖州市| 塔河县| 高清| 千阳县| 荆门市| 饶河县| 英吉沙县| 岳阳市| 鄂尔多斯市| 丹棱县| 正阳县| 扶风县| 布尔津县| 巴林右旗| 苍山县| 岐山县| 平远县| 湘潭市| 博兴县| 二连浩特市| 溧阳市| 渭源县| 沂水县| 交口县| 开原市| 芜湖市| 枣庄市| 鹿邑县| 依安县| 广河县|