界面編程C# ListBox的基本操作
作者:佚名
下面是C#界面編程的ListBox和ComboBox控件介紹,其中大部分是圍繞是C# ListBox介紹的,很基本,很實(shí)際的操作。
下面是C#界面編程的ListBox和ComboBox控件介紹,主要是關(guān)于關(guān)于C# ListBox的介紹。
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace ListAndCombo
- {
- public partial class ListAndCombo : Form
- {
- public ListAndCombo()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- //初始化設(shè)置
- //ListBox 設(shè)置
- listBox1.Items.Add("1000 以下");
- listBox1.Items.Add("1001~2000");
- listBox1.Items.Add("2001~3000");
- listBox1.Items.Add("3001~4000");
- listBox1.Items.Add("4001~6000");
- listBox1.Items.Add("6001~8000");
- listBox1.Items.Add("8001~10000");
- listBox1.Items.Add("10000 以上");
- //ComboBox 設(shè)置
- comboBox1.Items.Add("身份證");
- comboBox1.Items.Add("學(xué)生證");
- comboBox1.Items.Add("教師證");
- comboBox1.Items.Add("軍人證");
- comboBox1.Items.Add("護(hù)照");
- }
- private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- label3.Text = listBox1.SelectedItem.ToString();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- label4.Text = comboBox1.SelectedItem.ToString();
- }
- }
- }
以上就是對(duì)編程界面實(shí)現(xiàn)的C# ListBox的簡(jiǎn)單介紹。
【編輯推薦】
責(zé)任編輯:阡陌
來(lái)源:
網(wǎng)絡(luò)轉(zhuǎn)載