Windows基础控件使用
2021-04-02 18:25
标签:工具 常用事件 运行 更改 oid 窗体 box drop tip button按钮 textbox 文本框事件textchanged label标签 checkbox复选框 private void textBox1_TextChanged(object sender, EventArgs e) 密码显示姓名 复选框中代码 private void checkBox1_CheckedChanged(object sender, EventArgs e) private void checkBox2_CheckedChanged(object sender, EventArgs e) 添加radiobutton单选按钮代码使用如下: private void radioButton1_CheckedChanged(object sender, EventArgs e) } private void radioButton2_CheckedChanged(object sender, EventArgs e) Listbox列表框 找到items属性 点开集合 显示字符串集合编辑器 编写代码 private void listBox1_SelectedIndexChanged(object sender, EventArgs e) 组合框ComboBox 属性 dropdownstyle 控制外观和功能。 有simple ,dropdown,dropdownlist 3个选项 常用事件 leave 当控件不再是窗体的活动控件事发生。 selectedindexchanged 更改控件的selectedindew属性发生 首先进入items 集合编写字符串 然后代码 运行 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) ToolTip工具提示 Windows基础控件使用 标签:工具 常用事件 运行 更改 oid 窗体 box drop tip 原文地址:https://www.cnblogs.com/ricky1234/p/9212571.html
{
if (textBox1.Text == "123") textBox2.Text = "小明";
else textBox2.Text = ("密码错误");
}
{
if (checkBox1.Checked == true && checkBox2.Checked==true)
textBox3.Text = "我喜欢" + checkBox1.Text + "和" + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "我喜欢" + checkBox1.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "我喜欢" + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "";
}
{
if (checkBox1.Checked == true && checkBox2.Checked==true)
textBox3.Text = "我喜欢" + checkBox1.Text + "和" + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "我喜欢" + checkBox1.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "我喜欢" + checkBox2.Text;
else if (checkBox1.Checked == true && checkBox2.Checked == false)
textBox3.Text = "";
}
{
if (radioButton1.Checked == true)
textBox4.Text = "我很"+radioButton1.Text;
{
}
{
if (radioButton2.Checked == true)
textBox4.Text = "我很" + radioButton2.Text;
}
}
{
textBox5.Text = "你喜欢第" + listBox1.SelectedIndex.ToString() + "种颜色:"+listBox1.Text;
}
}
{
if (comboBox1.SelectedIndex == 0) textBox6.Text = "白羊座";
else if (comboBox1.SelectedIndex == 1) textBox6.Text = "金牛座";
else if (comboBox1.SelectedIndex == 2) textBox6.Text = "双子座";
else if (comboBox1.SelectedIndex == 3) textBox6.Text = "蟹座";
else if (comboBox1.SelectedIndex == 4) textBox6.Text = "狮子";
else if (comboBox1.SelectedIndex == 5) textBox6.Text = "处女";
else if (comboBox1.SelectedIndex == 6) textBox6.Text = "天平";
else if (comboBox1.SelectedIndex == 7) textBox6.Text = "天蝎";
else if (comboBox1.SelectedIndex == 8) textBox6.Text = "射手";
else if (comboBox1.SelectedIndex == 9) textBox6.Text = "魔蝎";
else if (comboBox1.SelectedIndex ==10)
textBox6.Text = "水瓶";
else if (comboBox1.SelectedIndex ==11) textBox6.Text = "双鱼";
}
}
}