Note that there are some explanatory texts on larger screens.

plurals
  1. POPictureBox size coordinates relation
    text
    copied!<p>I'm asking a question here cause I'm not sure how to search it in google, I don't know the word how to call this.</p> <p>What I mean is a "zero point" which basically located at upper-left corner of the element, pictureBox for an example. So when I set new width and height properties for my pictureBox it works fine but it's relative to top left corner.</p> <p>What I mean is you've got pictureBox, let's say 100 x 100 and you desire decrease it to 50 x 100, so you will get "empty space" under your picture box, not upper. PictureBox counts it's properties from this one top left corner zero point.</p> <p>And what I need is to change this point to the another corner.<br> So when I change my height it count up, not down. Help me please.</p> <p>I really hope you can understand me.</p> <p>Wow, thank you guys for your advices! I've tested anchor property and Top += 50; now, doesn't solve my problem. Let me try to describe it another way. You have an image (100px) with grass 50px at bottom and sky 50px at the top. So you have picturebox with height 100. If you set pictureBox.height = 50; you will see only sky. But I need to leave only grass. The main problem I see here is because this zero point at top left corner.</p> <p>Here is an example:</p> <p><img src="https://i.stack.imgur.com/MQ1ZI.png" alt="Simple image splitted onto the two sides: earth and sky"></p> <p>Button1 click event:</p> <pre><code>private void button1_Click(object sender, EventArgs e) { pictureBox1.Height = 150; } </code></pre> <p>The result which you will get after you press the button:</p> <p><img src="https://i.stack.imgur.com/jPR7q.png" alt="result of the button press"></p> <p>But I need another result:</p> <p><img src="https://i.stack.imgur.com/HZGXU.png" alt="enter image description here"></p> <p>As I understand it happens because height property counts from the top left corner. So if I change it to bottom left or right corner it will works the way I need. Help me please to change this point...</p> <p>MSDN reference: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode(v=vs.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.picturebox.sizemode(v=vs.71).aspx</a></p> <blockquote> <p>Valid values for this property are taken from the PictureBoxSizeMode enumeration. By default, in PictureBoxSizeMode.Normal mode, the Image is placed in the <strong>upper left corner</strong> of the PictureBox, and any part of the image too big for the PictureBox is clipped. Using the PictureBoxSizeMode.StretchImage value causes the image to stretch to fit the PictureBox.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload