Click here to Skip to main content
15,913,941 members
Home / Discussions / C#
   

C#

 
GeneralDrag and drop file into application Pin
Blubbo2-Apr-08 6:25
Blubbo2-Apr-08 6:25 
GeneralRe: Drag and drop file into application Pin
led mike2-Apr-08 6:42
led mike2-Apr-08 6:42 
GeneralRe: Drag and drop file into application Pin
Blubbo2-Apr-08 6:57
Blubbo2-Apr-08 6:57 
GeneralRe: Drag and drop file into application Pin
Blubbo2-Apr-08 7:21
Blubbo2-Apr-08 7:21 
GeneralRe: Drag and drop file into application Pin
led mike2-Apr-08 7:45
led mike2-Apr-08 7:45 
AnswerRe: Drag and drop file into application Pin
Blubbo2-Apr-08 8:02
Blubbo2-Apr-08 8:02 
GeneralPass in-memory assembly to ReportViewer Pin
AndrusM2-Apr-08 5:29
AndrusM2-Apr-08 5:29 
QuestionUnable to set location of picturebox programatically Pin
KaKa'2-Apr-08 4:33
KaKa'2-Apr-08 4:33 
I have a picturebox which was created programatically and its location should be determined when the form loads.

I set the location property to a point but no matter what point is set, the picturebox appears on a fixed location when the form loads.

Below is the code:

<br />
In the picture class:<br />
<br />
public PictureBox PlaceFlower()<br />
{<br />
      PictureBox flower = new PictureBox();<br />
      flower.Height = 80;<br />
      flower.Width = 80;<br />
      flower.Image = Image.FromFile("C:\\grass.bmp");<br />
            <br />
      return flower;<br />
}<br />
<br />
public Point SetCoordinates()<br />
{<br />
      int x = randomClass.Next(10,50);<br />
      int y = randomClass.Netxt(10,50);<br />
      Point p = new Point(x, y);<br />
<br />
      return p;<br />
}<br />
<br />
<br />
In the form class:<br />
<br />
private PictureBox flowerPicture;<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
      flowerPicture = picture.PlaceFlower();<br />
      flowerPicture.Location = picture.SetCoordinates();<br />
}<br />
<br />


I've checked the values of the point coordinates and they vary each time the form loads but somehow the picturebox always remain fixed at the same point on the form. I have made sure that the locked property of the control is set to false.

What is the problem with the picturebox location? Frown | :(
GeneralRe: Unable to set location of picturebox programatically Pin
Luc Pattyn2-Apr-08 5:53
sitebuilderLuc Pattyn2-Apr-08 5:53 
GeneralRe: Unable to set location of picturebox programatically Pin
KaKa'3-Apr-08 5:31
KaKa'3-Apr-08 5:31 
QuestionButtons and Controls look different in 2008 designer than when run Pin
UTRocketFan2-Apr-08 4:06
UTRocketFan2-Apr-08 4:06 
GeneralRe: Buttons and Controls look different in 2008 designer than when run Pin
damianrda2-Apr-08 5:22
damianrda2-Apr-08 5:22 
GeneralCPU temperature Pin
half-life2-Apr-08 3:27
half-life2-Apr-08 3:27 
GeneralRe: CPU temperature Pin
Dave Kreskowiak2-Apr-08 3:59
mveDave Kreskowiak2-Apr-08 3:59 
GeneralRe: CPU temperature Pin
half-life2-Apr-08 4:46
half-life2-Apr-08 4:46 
GeneralDa how can I see the details of an assembly Pin
sujithkumarsl2-Apr-08 3:08
sujithkumarsl2-Apr-08 3:08 
GeneralRe: Da how can I see the details of an assembly Pin
papadimitriou2-Apr-08 3:20
papadimitriou2-Apr-08 3:20 
GeneralBeginners foreach and condition question Pin
NewToAspDotNet2-Apr-08 3:02
NewToAspDotNet2-Apr-08 3:02 
GeneralRe: Beginners foreach and condition question Pin
Simon P Stevens2-Apr-08 3:21
Simon P Stevens2-Apr-08 3:21 
GeneralRe: Beginners foreach and condition question Pin
papadimitriou2-Apr-08 3:27
papadimitriou2-Apr-08 3:27 
GeneralRe: Beginners foreach and condition question Pin
NewToAspDotNet2-Apr-08 3:33
NewToAspDotNet2-Apr-08 3:33 
GeneralRe: Beginners foreach and condition question [modified] Pin
Stu Richardson2-Apr-08 4:27
Stu Richardson2-Apr-08 4:27 
GeneralRe: Beginners foreach and condition question Pin
Clive D. Pottinger2-Apr-08 4:43
Clive D. Pottinger2-Apr-08 4:43 
QuestionHow to load data? Pin
Hum Dum2-Apr-08 2:42
Hum Dum2-Apr-08 2:42 
GeneralStupid question of the day (Trees) Pin
martin_hughes2-Apr-08 2:26
martin_hughes2-Apr-08 2:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.