布局过程:
1.Form1:
2.panel1:
3.panel2,panel3
Dock = Top
Dock = Fill
AutoScroll = TRUE
4.pnlTop
Dock = Left5.pnlMin,pnlMax
//最好有个BackgroundImage
visible = FALSE
//最好有个BackgroundImage
Anchor = Bottom,Left
visible = TRUE
最后,大概这个样子:
分别给pnlMin和pnlMax添加Click事件:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private int maxHeightSize = 0;
public Form1()
{
InitializeComponent();
maxHeightSize = panel2.Height;
}
private void pnlMax_Click(object sender, EventArgs e)
{
panel2.Height = maxHeightSize;
pnlMax.Visible = false;
pnlMin.Visible = true;
}
private void pnlMin_Click(object sender, EventArgs e)
{
panel2.Height = pnlMin.Height;
pnlMax.Visible = true;
pnlMin.Visible = false;
}
}
}
演示效果:
------------------------------------------------------------------------------------end
posted on 2011-06-10 11:43
Ying-er 阅读(1508)
评论(0) 编辑 收藏 所属分类:
.Net