private void btnAdvance_Click(object sender, EventArgs e)
{
if (!gbAdvance.Visible)
{
gbAdvance.Visible = true;
this.Height = ht + gbAdvance.Height;
btnAdvance.Text = "隐藏高级选项(&H)";
}
else
{
gbAdvance.Visible = false;
this.Height = ht;
btnAdvance.Text = "显示高级选项(&S)";
}
}
private void 窗体名称_Load(object sender, EventArgs e)
{
ht=gbContents.Height + panControls.Height+SystemInformation.CaptionHeight+SystemInformation.BorderSize.Height*2;
this.Height = ht;
}
完成效果如图所示: