Re: Why doesn't work this asigment?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 29 May 2006 20:41:00 +0100
Alberto <alberto@xxxxxxxxxx> 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 - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- References:
- Why doesn't work this asigment?
- From: Alberto
- Why doesn't work this asigment?
- Prev by Date: Re: Why doesn't work this asigment?
- Next by Date: webform password protected page
- Previous by thread: Re: Why doesn't work this asigment?
- Next by thread: webform password protected page
- Index(es):
Relevant Pages
|