winform,C#:
我在一个Form1是放入了多个radioButton,一个linklabel和一个textBox.
设置textBox属性multiLine使它可以换行,并在textBox中放入三个label.我想要实现单击radioButton时,在label显示相关文字,单击linklabel在textBox显示文本.再次单击radioButton时textBox中的内容清空,并在label显示radioButton相应的内容.请问:
如何单击linklabel后再次单击其中一个radioButton,清空textBox内容,还能在lable中显示对应文字.
/*我的思路是在单击linklabel时将textBox中所有的label隐藏,并在textbox中显示文字,并设置linklabel的linkVisibled=true,然后单击radiobutton时,if(linklabel.linkVisibled==true),textBox清空,所有label.Visible=true并显示radiobutton与相对应的label显示文字.*/
可是我不知道如何在单击完linklabel后再次单击其中一个radiobutton时将textbox.text清空,label.Visible=true;private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
label1.Visible = false;
label2.Visible = false;
label3.Visible = false;
textBox1.Text = Environment.NewLine + "显示textbox1.text" + Environment.NewLine + "隐藏lable";
linkLabel1.LinkVisited = true;
foreach(Control c in Controls)
{
RadioButton r = c as RadioButton;
if (r.Checked == true)//这里是错的.不知如何修改.
{
r.Checked = false;
}
}
}
private void radioButtonChanged()
{
if (linkLabel1.LinkVisited == true)
{
foreach (Control c in Controls)
{
RadioButton r = c as RadioButton;
if (r.Checked == true)
{
label1.Visible = true;
label2.Visible = true;
label3.Visible = true;
textBox1.Text = "";
}
}
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "显示radiobutton1";
label2.Text = "";
label3.Text = "";
Form1 newForm1 = new Form1();
newForm1.radioButtonChanged();
}//这个方法实现不了..
我在一个Form1是放入了多个radioButton,一个linklabel和一个textBox.
设置textBox属性multiLine使它可以换行,并在textBox中放入三个label.我想要实现单击radioButton时,在label显示相关文字,单击linklabel在textBox显示文本.再次单击radioButton时textBox中的内容清空,并在label显示radioButton相应的内容.请问:
如何单击linklabel后再次单击其中一个radioButton,清空textBox内容,还能在lable中显示对应文字.
/*我的思路是在单击linklabel时将textBox中所有的label隐藏,并在textbox中显示文字,并设置linklabel的linkVisibled=true,然后单击radiobutton时,if(linklabel.linkVisibled==true),textBox清空,所有label.Visible=true并显示radiobutton与相对应的label显示文字.*/
可是我不知道如何在单击完linklabel后再次单击其中一个radiobutton时将textbox.text清空,label.Visible=true;private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
label1.Visible = false;
label2.Visible = false;
label3.Visible = false;
textBox1.Text = Environment.NewLine + "显示textbox1.text" + Environment.NewLine + "隐藏lable";
linkLabel1.LinkVisited = true;
foreach(Control c in Controls)
{
RadioButton r = c as RadioButton;
if (r.Checked == true)//这里是错的.不知如何修改.
{
r.Checked = false;
}
}
}
private void radioButtonChanged()
{
if (linkLabel1.LinkVisited == true)
{
foreach (Control c in Controls)
{
RadioButton r = c as RadioButton;
if (r.Checked == true)
{
label1.Visible = true;
label2.Visible = true;
label3.Visible = true;
textBox1.Text = "";
}
}
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "显示radiobutton1";
label2.Text = "";
label3.Text = "";
Form1 newForm1 = new Form1();
newForm1.radioButtonChanged();
}//这个方法实现不了..
{
if(c.gettype()==this.radiobutton1.gettype()){
RadioButton r = c as RadioButton;
if (r.Checked == true)//这里是错的.不知如何修改.
{
r.Checked = false;
}
}
} private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "显示radiobutton1";
label2.Text = "";
label3.Text = "";
Form1 newForm1 = new Form1();
newForm1.radioButtonChanged();
}//这个方法实现不了..这个是要干吗?你的需求太多了,看的晕晕的
我在一个Form1是放入了多个radioButton,一个linklabel和一个textBox.
设置textBox属性multiLine使它可以换行,并在textBox中放入三个label.
我想要实现单击radioButton时,在label显示相关文字,单击linklabel在textBox显示文本.再次单击radioButton时textBox中的内容清空,并在label显示radioButton相应的内容. 问题:
我单击linklabel将textBox中所有的label隐藏,并在textbox中显示文字可以实现,可是当我再单击radiobutton时,textBox不知如何清空,并让label显示.
//我还是把所有的代码贴出来吧.private void radioButton48_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "[身似菩提]";
label2.Text = "消耗愤怒值:130 (有愤怒腰带时消耗:104)";
label3.Text = "使用消果:将自己受到的法术反作用给施法者(针对某些特殊情况下无效),效果持续两回合.";
label4.Text = "特殊说明:无."; }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
label1.Text = "[详解]";
label2.Text = "";
label3.Text = "";
label4.Text = "";
textBox1.Text = System.Environment.NewLine+System.Environment.NewLine+"·可以交换HP,MP,不能交换SP ";
label2.Visible = false;
label3.Visible = false;
label4.Visible = false;
}
//那么多个radiobutton 我要在哪个事件里写:
//textBox1.Text="";
//label2.Visible=true;
//label3.Visible=true;
//label4.Visible=true;
在click里写就行了.
谢谢大家 140分满多 散了吧.