C# 程式碼寫ComboBox控制元件
阿新 • • 發佈:2018-12-28
ComboBox控制元件
1 申明
private
System.Windows.Forms.
ComboBox
comboBox_info;
2 例項化 this .comboBox_info = new System.Windows.Forms. ComboBox ();
3 設定 //
// comboBox_info
//
this
.comboBox_info.Location =
new
System.Drawing.
Point
(200, 100);
this
.comboBox_info.Name =
"comboBox_info"
;
this
.comboBox_info.Size =
new
System.Drawing.
Size
(100, 30);
this
.comboBox_info.TabIndex = 1;
this
.comboBox_info.Items.Add(
"this is one"
);
this
.comboBox_info.Items.Add(
"this is two"
);
this
.comboBox_info.Items.Add(
"this is three"
);
this
.comboBox_info.Items.Add(
"this is four"
);
this
.comboBox_info.Items.Add(
"this is five"
);
this
.comboBox_info.SelectedIndex = 0;
this
.comboBox_info.Text =
"0"
;
4 加入視窗 this .Controls.Add( this .comboBox_info);
2 例項化 this .comboBox_info = new System.Windows.Forms. ComboBox ();
3 設定 //
4 加入視窗 this .Controls.Add( this .comboBox_info);