C# 代码写ComboBox控件

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ALONE_WORK/article/details/61199139
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);

猜你喜欢

转载自blog.csdn.net/ALONE_WORK/article/details/61199139