Alberto <al*****@nospam.com> wrote:
pictureBox1.Location.X = pnl.Size.Width - 50;
pictureBox1.Location returns you a Point. Because Point is a value
type, if you made a change to X afterwards, that wouldn't change the
value of pictureBox1.Location anyway, because the value returned is
disassociated from the property.
Short answer: that's not how value types work. Use
Point p = pictureBox1.Location;
p.X = pnl.Size.Width - 50;
pictureBox1.Location = p;
(Or do it in one go as per Galcho's code.)
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too