public override Size GetPreferredSize(Size proposedSize) { if (!cb.Checked) { return(Size.Empty); } Size s = c.GetPreferredSize(proposedSize); var p = this.Padding; s.Width += p.Left + p.Right; s.Height += p.Top + p.Bottom + dh; FlowLayoutPanel2 p2 = (FlowLayoutPanel2)this.Parent; if (flag || !fillHeight || p2.isAdjusting) { return(s); } foreach (Control cc in p2.Controls) { if (cc is Control2) { if (((Control2)cc).lastClicked > this.lastClicked) { return(s); } } } flag = true; var r = p2.GetPreferredSize(proposedSize); int h1 = p2.Height; dh = Math.Max(h1 - r.Height, 0); flag = false; s.Height += dh; return(s); }
public override Size GetPreferredSize(Size proposedSize) { return(host.GetPreferredSize(proposedSize)); }