/// <summary> /// Resize and arrange child controls according to ButtonSize preset /// </summary> /// <param name="size">ButtonSize preset</param> private void InitButtonSize(ExpandButtonSize size) { _expandButtonSize = size; switch (_expandButtonSize) { case ExpandButtonSize.Small: pictureBox1.Location = new Point(0, 3); pictureBox1.Size = new Size(16, 16); lblLine.Location = new Point(20, 18); lblHeader.Location = new Point(20, 1); break; case ExpandButtonSize.Normal: pictureBox1.Location = new Point(0, 3); pictureBox1.Size = new Size(24, 24); lblLine.Location = new Point(30, 22); lblHeader.Location = new Point(30, 3); break; case ExpandButtonSize.Large: pictureBox1.Location = new Point(0, 3); pictureBox1.Size = new Size(35, 35); lblLine.Location = new Point(41, 28); lblHeader.Location = new Point(41, 3); break; default: throw new ArgumentOutOfRangeException(); } // after resize all child controls - do resize for entire ExpandCollapseButton control: Height = pictureBox1.Location.Y + pictureBox1.Height + 2; }
/// <summary> /// Resize and arrange child controls according to ButtonSize preset /// </summary> /// <param name="size">ButtonSize preset</param> private void InitButtonSize(ExpandButtonSize size) { _expandButtonSize = size; switch (_expandButtonSize) { case ExpandButtonSize.Small: // pictureBox1.Location = new Point(0, 3); // pictureBox1.Size = new Size(16, 16); //lblLine.Location = new Point(20, 18); // lblHeader.Location = new Point(20, 1); break; case ExpandButtonSize.Normal: // pictureBox1.Location = new Point(0, 3); // pictureBox1.Size = new Size(24, 24); // lblLine.Location = new Point(30, 22); // lblHeader.Location = new Point(30, 3); break; //case ExpandButtonSize.Large: // pictureBox1.Location = new Point(0, 3); // pictureBox1.Size = new Size(35, 35); // lblLine.Location = new Point(41, 28); // lblHeader.Location = new Point(41, 3); // break; default: throw new ArgumentOutOfRangeException(); } }