c# panel显示不了

来源:百度知道 编辑:UC知道 时间:2024/09/27 07:22:44
我做了一个界面,上面有两个按扭,我的思想是加载的时候,显示panel1,点击按扭2的时候,隐藏panel1而显示panel2,之后点击按扭1在隐藏panel2显示panel1,就是在这个时候,出现了问题,显示不出panel1了,是不是要容器重新生效一下才行,具体代码是怎么样的。忘高手解答,有加分

我这里有完整的代码 !! 唉,这百度说我答案重复了,我觉得确实是重复了点!但这是我亲自写的代码,根本没有抄!真没办法~~~~

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
//加载时 把panel1显示,把panel2隐藏
this.panel1.Visible = true;
this.panel2.Visible = false;
}

private void button1_Click(object sender, EventArgs e)
{
//点一下按钮1把panel2隐藏,把panel1显示
this.panel2.Visible = false;
this.panel1.Visible = true;
}

private void button2_Click(object sender, EventArgs e)
{
//点一下按钮2把panel1隐藏,把panel2显示
this.panel1.Visible = false;
this.panel2.Visible = true;
}