I’ve got this code in a pair of button click event handlers on a C# form:
class frmLogin { private const int SHORT_HEIGHT = 120; private const int LONG_HEIGHT = 220; private EventHandler ExpandHandler; private EventHandler ShrinkHandler; public frmLogin() { InitializeComponent(); ExpandHandler = new EventHandler(btnExpand_Click); ShrinkHandler = new EventHandler(btnShrink_Click); btnExpand.Click += ExpandHandler; } private void btnExpand_Click(object sender, EventArgs e) { this.Height = LONG_HEIGHT; btnExpand.Text = '<< Hide Server'; btnExpand.Click -= ExpandHandler; btnExpand.Click += ShrinkHandler; } private void btnShrink_Click(object sender, EventArgs e) { this.Height = SHORT_HEIGHT; btnExpand.Text = 'Choose Server >>'; btnExpand.Click -= ShrinkHandler; btnExpand.Click += ExpandHandler; } }
The text change occurs without issue, but on one particular client machine, a Dell M4300 laptop workstation, the height change does not take effect. Has anyone resolved a similar issue, and what was the fix if so?
My guess: The DPI or system font size is different on that machine and your form’s AutoScaleMode is either ‘Font’ or ‘Dpi’, making your form’s MinimumSize or MaximumSize prevent the change.