void B_Title_Click(object sender, EventArgs e) { int height = 0; if (_isPanelVisible) { P_Back.Visible = false; P_Back.SetBounds(0, 0, P_Back.Width, 0, BoundsSpecified.Height); B_Title.Image = Properties.Resources.tree_close; } else { P_Back.Visible = true; height = _items[_nameList[0]].Height; P_Back.SetBounds(0, 0, P_Back.Width, height, BoundsSpecified.Height); B_Title.Image = Properties.Resources.tree_open; } _isPanelVisible = !_isPanelVisible; this.Height = B_Title.Height + height; }
void resizePanel() { P_Back.SuspendLayout(); P_Back.SetBounds(0, 0, 0, _items.Count * (_labelHeight + 1), BoundsSpecified.Height); P_Back.ResumeLayout(); }