C# 代码写ComboBox控件

152 阅读1分钟

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);