C # - unable to set form.height

I have this code in a pair of button click event handlers in 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; } } 

Changing the text occurs without problems, but on one specific client computer, the Dell M4300 laptop workstation, the height change does not take effect. Has anyone resolved a similar problem, and what has been fixed if so?

+4
source share
3 answers

My guess: the size of the DPI font or the system font is different on this computer, and your AutoScaleMode form is either a "font" or "Dpi", which makes your MinimumSize or MaximumSize form prevent it from changing.

+3
source

Check the display mode for the laptop, and in particular, check the aspect ratio setting. Sometimes laptops do strange things to facilitate a wide, short screen.

+2
source

Make sure you do not have one of these AutoScale / Size / Anyatever parameters set to true.

0
source

All Articles