这是代码:这是初始化的界面:这是全部可见的界面:VIp为radioButton1 普通用户为 radioButton2
点击VIP时,没反应。中间两张图片不会显示。如何解决?
还有,这个窗口运行时,为何会有个DOS窗口弹出?以前写的其它窗口程序没DOS窗口弹出。radioButton
点击VIP时,没反应。中间两张图片不会显示。如何解决?
还有,这个窗口运行时,为何会有个DOS窗口弹出?以前写的其它窗口程序没DOS窗口弹出。radioButton
2.或改成下面的代码 点击VIP也无效。 private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
SetVisible(true);
button1.Location = new Point(12, 65);
button3.Location = new Point(105, 65);
button5.Location = new Point(198, 65);
button2.Location = new Point(12, 157);
button4.Location = new Point(105, 157);
button6.Location = new Point(198, 157);
}
} private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked == true)
{
button1.Location = new Point(12, 65);
button3.Location = new Point(105, 65);
button5.Location = new Point(198, 65);
button2.Location = new Point(12, 157);
button4.Location = new Point(105, 157);
button6.Location = new Point(198, 157);
SetVisible(false);
}
}3.为啥这个窗口程序,运行时会弹出相应的DOS窗口?
击VIP时,没反应。中间两张图片不会显示,这个问题,与你的Form1_Load()方法有关,你无论点击哪儿个radio好像都调用了这个方法,
把Form1_Load()内部的代码都注释掉,出现第二张图的的情况,点击普通用户,依然无效。
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); this.radioButton2.Checked = true;
this.button3.Visible = false;
this.button4.Visible = false;
} private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
this.button3.Visible = true;
this.button4.Visible = true;
} private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
this.button3.Visible = false;
this.button4.Visible = false;
}
}我试了下,没问题。难道因为楼主设置了Location导致的?
private void radioButton_Click(object sender, EventArgs e)
{
button1.Visible = !(button2.Visible = !button2.Visible);
}
响应事件的方法 如:
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
}这部分代码 若自己手动敲出来,就会失效。
在页面布局文件中,双击相应的控件。自动生成的这部分代码(再向里面添加具体内容),才能运行。
不知道你们的VS 是不是这样。
感谢楼上的各位,尤其是2楼和10楼。