码迷,mamicode.com
首页 > 其他好文 > 详细

左侧收缩菜单

时间:2019-05-07 17:03:18      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:int   pac   raw   orm   linq   com   容器   send   false   

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

namespace WinForm测试
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

int panel1Height = 25;
int panel2Height = 200;
int panel3Height = 25;
int panel4Height = 150;
int panel5Height = 25;
int panel6Height = 100;
private void panel1_Click(object sender, EventArgs e)
{
if (panel2.Visible==true) //已显示容器2,需要隐藏容器2
{
panel2.Visible = false; //隐藏容器2,容器3和容器5就要移动到容器1之下
panel3.Top = panel1Height; //容器3移动到容器1之下
panel5.Top = panel1Height + panel3Height; //把容器5移动到容器3下
}else{ //已隐藏容器2,需要显示容器2
panel2.Visible = true; //显示容器2
panel2.Top = panel1Height; //容器2放在容器1之下
panel3.Top = panel1Height + panel2Height; //容器3放在容器2之下
panel4.Visible = false;
panel6.Visible = false;
panel5.Top = panel1Height + panel2Height + panel3Height; //把容器5让在容器3之下
}
}

private void panel3_Click(object sender, EventArgs e)
{
panel3.Top = panel1Height;
if (panel4.Visible == true)
{
panel4.Visible = false;
panel5.Top = panel1Height + panel3Height;
}
else
{
panel4.Visible = true;
panel2.Visible = false;
panel6.Visible = false;
panel4.Top = panel1Height + panel3Height;
panel5.Top = panel1Height + panel3Height + panel4Height;
}
}

private void panel5_Click(object sender, EventArgs e)
{
panel3.Top = panel1Height;
panel5.Top = panel1Height+panel3Height;
if (panel6.Visible == true)
{
panel6.Visible = false;
}
else
{
panel6.Visible = true;
panel2.Visible = false;
panel4.Visible = false;
panel6.Top = panel1Height+panel3Height+panel5Height;
}
}


}
}

左侧收缩菜单

标签:int   pac   raw   orm   linq   com   容器   send   false   

原文地址:https://www.cnblogs.com/jmy9/p/10826427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!