private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
comboBox1.Items.Add("One");
comboBox1.Items.Add("Two");
comboBox1.Items.Add("Three");
label1.Text = comboBox1.SelectedIndex.ToString();
//comboBox1.SelectedIndex = 0;
comboBox1.Text = "com1";
label2.Text = comboBox1.Items.Count.ToString();
}
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
Graphics g = e.Graphics;
Font bFont = new Font("Arial", 8, FontStyle.Bold);
Font lFont = new Font("Arial", 12, FontStyle.Bold);
if (comboBox1.Items[e.Index] == "Two")
g.DrawString(comboBox1.Items[e.
c# 在 ComboBox 控件中创建大小可变的文本
最新推荐文章于 2023-06-22 15:02:36 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)