0

I have an issue on something I expected to be trivial.

I am developing a Visual Studio 2012 Windows Form Project using C#. In my Form there is a PictureBox pbMaps that I use to display stuff. I also have a checkBox cbLab that I use to determine between two states of the application. One of the differences between the two states is that pbMaps has two be in a different Location and have a different size. So I went in the Designer of Visual Studio and checked, by moving and resizing by hand, the values I wanted for pbMaps.Size and pbMaps.Location in both states. Then I plugged those values in the code reported here:

    private void cbLab_CheckedChanged(object sender, EventArgs e)
    {
        if (!cbLab.Checked)
        {
            pbMaps.Height = 1160;
            pbMaps.Width = 916;
            pbMaps.Location = new Point(83, 12);
        }
        else
        {
            pbMaps.Height = 580;
            pbMaps.Width = 458;
            pbMaps.Location = new Point(277, 12);
        }
    }

I was expecting this to work perfectly, but what I found out is that the positions during the operation of the application, the PictureBox moves to different positions that those I expected, and has different size. The Locations are moved to the right, with respect to the ones I found in the Designer. The larger size (916 by 1160) is correct, while the other appears larger than in the Designer.

Am I forgetting something somewhere?

Thanks

4

0 回答 0