Take X size of a PictureBox?

2
I have a Picture Box , and in a certain part of the code I edit the horizontal size (x) of it, then down in the code, I need to edit only the vertical size (y). I want the size of (x) to continue the same as it is currently.

Just one example:

pb->Size = System::Drawing::Size(2, 110 + 8);
pb->Size = System::Drawing::Size(AQUI SERIA ALGO QUE CONTENHA O VALOR ATUAL DE X, 110 + 9);

Or some other alternative that gets the same result.

Remembering that I want the size x and not the location x

    
asked by anonymous 19.11.2014 / 01:52

1 answer

4

You can read the current width through the Width property, like this:

pb->Size = System::Drawing::Size(pb->Size.Width, 110 + 9);

But if you just want to change the value of the height, I suggest going directly to change the height value:

pb->Size.Height = 110 + 9;

More details in the documentation: System::Drawing::Size .

    
19.11.2014 / 02:33