• 左侧收缩菜单


     1         int panel1Height = 25;
     2         int panel2Height = 200;
     3         int panel3Height = 25;
     4         int panel4Height = 150;
     5         int panel5Height = 25;
     6         int panel6Height = 100;
     7         private void panel1_Click(object sender, EventArgs e)
     8         {
     9             if (panel2.Visible == true) //已显示容器2,需要隐藏容器2
    10             {
    11                 panel2.Visible = false; //隐藏容器2,容器3和容器5就要移动到容器1之下
    12                 panel3.Top = panel1Height; //容器3移动到容器1之下
    13                 panel5.Top = panel1Height + panel3Height; //把容器5移动到容器3下
    14             }
    15             else
    16             { //已隐藏容器2,需要显示容器2
    17                 panel2.Visible = true; //显示容器2
    18                 panel2.Top = panel1Height; //容器2放在容器1之下
    19                 panel3.Top = panel1Height + panel2Height; //容器3放在容器2之下
    20                 panel4.Visible = false;
    21                 panel6.Visible = false;
    22                 panel5.Top = panel1Height + panel2Height + panel3Height; //把容器5让在容器3之下
    23             }
    24         }
    25 
    26         private void panel3_Click(object sender, EventArgs e)
    27         {
    28             panel3.Top = panel1Height;
    29             if (panel4.Visible == true)
    30             {
    31                 panel4.Visible = false;
    32                 panel5.Top = panel1Height + panel3Height;
    33             }
    34             else
    35             {
    36                 panel4.Visible = true;
    37                 panel2.Visible = false;
    38                 panel6.Visible = false;
    39                 panel4.Top = panel1Height + panel3Height;
    40                 panel5.Top = panel1Height + panel3Height + panel4Height;
    41             }
    42         }
    43 
    44         private void panel5_Click(object sender, EventArgs e)
    45         {
    46             panel3.Top = panel1Height;
    47             panel5.Top = panel1Height + panel3Height;
    48             if (panel6.Visible == true)
    49             {
    50                 panel6.Visible = false;
    51             }
    52             else
    53             {
    54                 panel6.Visible = true;
    55                 panel2.Visible = false;
    56                 panel4.Visible = false;
    57                 panel6.Top = panel1Height + panel3Height + panel5Height;
    58             }
    59         }

     

  • 相关阅读:
    HTML5的进步与优势
    jquery项目中一些比较常用的简单方法
    MVC架构下将查询到的数据以表格形式展现出来
    MVC架构下的导出为excel的代码
    MVC中ViewData中数据转化成json形式的变量的方法
    jQuery实现CheckBox全选,全不选,反选代码
    C#导出到EXCEL
    jQuery常见操作实现和常用函数方法总结
    jQuery中运用正则表达式验证输入是否有特殊字符
    DataTime+当前时间转换
  • 原文地址:https://www.cnblogs.com/jmy9/p/10795598.html
Copyright © 2020-2023  润新知