views:

906

answers:

3

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?

+2  A: 

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

MusiGenesis
I tried a number of aspect ratio settings (gpu default, system default, gpu-smart), rotated the display, everything, but it didn't make any difference. I'm wondering if there is any chance that I need to restart the machine for this to properly take effect.
Mike Burton
Worth a shot. This sounds really weird.
MusiGenesis
I reset the DPI from 120 to 96, restarted the machine, and voilá, instant fix. Thanks!
Mike Burton
A: 

Make sure you do not have one of those AutoScale/Size/Whatever properties set to to true.

leppie
+2  A: 

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.

Martin Plante