radioButton& listBox&numericUpDown 操作

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了radioButton& listBox&numericUpDown 操作相关的知识,希望对你有一定的参考价值。

技术分享

private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
if (numericUpDown1.Value == 1)
radioButton1.Checked = true;
if (numericUpDown1.Value == 2)
radioButton2.Checked = true;
if (numericUpDown1.Value == 3)
radioButton3.Checked = true;

}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked)
numericUpDown1.Value = 1;
}

private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
numericUpDown1.Value = 2;
}

private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
if (radioButton3.Checked)
numericUpDown1.Value = 3;
}

private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
listBox2.Items.Add("English");
else
listBox2.Items.Remove("English");
}

private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
if (checkBox2.Checked)
listBox2.Items.Add("German");
else
listBox2.Items.Remove("German");

}

private void checkBox3_CheckedChanged(object sender, EventArgs e)
{
if (checkBox3.Checked)
listBox2.Items.Add("French");
else
listBox2.Items.Remove("French");
}





































以上是关于radioButton& listBox&numericUpDown 操作的主要内容,如果未能解决你的问题,请参考以下文章

背水一战 Windows 10 (33) - 控件(选择类): ListBox, RadioButton, CheckBox, ToggleSwitch

将ListBox选择更改为切换选择的最佳方法

WPF 基础控件之 RadioButton 样式

WPF + MVVM + RadioButton:使用单个属性处理绑定

Avalonia跨平台入门第十四篇之ListBox折叠列表

Avalonia跨平台入门第十五篇之ListBox聊天窗口