这是代码:这是初始化的界面:这是全部可见的界面:VIp为radioButton1     普通用户为 radioButton2
点击VIP时,没反应。中间两张图片不会显示。如何解决?
还有,这个窗口运行时,为何会有个DOS窗口弹出?以前写的其它窗口程序没DOS窗口弹出。radioButton

解决方案 »

  1.   

    你出发radio1的时候,radio2的值也会变,就会触发radio2的事件,将两个按钮隐藏了
      

  2.   

    1.将48  行到  57 行注释掉也一样,点击VIP没反应。
    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窗口?
      

  3.   

    弹DOS框是因为你 设置的output type是Console.Application.你把点击右键->property->output type拉框处选Windows.Application就行了。
    击VIP时,没反应。中间两张图片不会显示,这个问题,与你的Form1_Load()方法有关,你无论点击哪儿个radio好像都调用了这个方法,
      

  4.   

    弹出DOS框的问题解决了。
    把Form1_Load()内部的代码都注释掉,出现第二张图的的情况,点击普通用户,依然无效。
      

  5.   


    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导致的?
      

  6.   

    直接用Click事件,其中判断一下就可以了,不要用Chenged事件。
      

  7.   

    给radiobutton直接加click事件就行了
    private void radioButton_Click(object sender, EventArgs e)
            {
                button1.Visible = !(button2.Visible = !button2.Visible);
            }
      

  8.   

    在Chenged事件里面再做一次Changed判断,然后再改变按钮的可视性~
      

  9.   

    呵呵,问题已经解决,,可能是VS2012  的问题。
    响应事件的方法    如:
     private void radioButton1_CheckedChanged(object sender, EventArgs e)
            {
           
            }这部分代码 若自己手动敲出来,就会失效。
    在页面布局文件中,双击相应的控件。自动生成的这部分代码(再向里面添加具体内容),才能运行。
    不知道你们的VS  是不是这样。
    感谢楼上的各位,尤其是2楼和10楼。