c#练习四单元总结

test4-1

在numericUpDown1中

 trackBar1.Value =(int) numericUpDown1.Value;

在trackBar1中

numericUpDown1.Value = trackBar1.Value;

test4-2

在红绿蓝按钮里执行语句

this.BackColor = Color.FromArgb(hScrollBar1.Value, hScrollBar2.Value, hScrollBar3.Value);

实现窗体背景颜色转变

test4-3与test4-2类似

test4-4

this.ForeColor = Color.FromArgb(hScrollBar1.Value, hScrollBar2.Value, hScrollBar3.Value);

实现窗体前景颜色的改变

test4-5余test4-4类似

test4-6

在trackBar1中

progressBar1.Value =trackBar1.Value ;
this.Opacity = 0.5 + (double)trackBar1.Value / 100;

实现窗体透明度的变化

test4-7

在combox1中实现

switch(comboBox1.SelectedIndex)
{
case 0: radioButton1.Checked = true; break;
case 1: radioButton2.Checked = true; break;
case 2: radioButton3.Checked = true; break;
}

在radioButton1中

if (radioButton1.Checked == true)
comboBox1.SelectedIndex = 0;

radioButton2与3中类似

以此实现combox选择项与radiobutton的同步;

test4-8类似于test4-7

test4-9

在checkBox1中

if (checkBox1.Checked == true)
listBox1.Items.Add("English");
else
listBox1.Items.Remove("English");

在checkBox1与3中与checkbox1类似

实现同过CheckBox复选向listbox添加或删除东西

test4-10

在domainUpDown1中

listBox1.SelectedIndex = domainUpDown1.SelectedIndex;

在listBox1中

domainUpDown1.SelectedIndex = listBox1.SelectedIndex;

实现同步

原文地址:https://www.cnblogs.com/YuJiaJia/p/7589220.html