My intent is that the form be sized large enough to show the entire “buttonOK”, but not much larger. What actually happens is that the resized form ends up to small to even show the button at all.
public MyFormDlg()
{
InitializeComponent();
this.Height = this.buttonOK.Bounds.Bottom + SomePadding;
The
Heightproperty includes the height of the Window’s Title bar, thus the client area (the one the button bounds are relative to) is smaller than you expect.This works:
I didn’t find a
ClientHeightproperty, can this be done any simpler?