• Facebook
  • RSS Feed
  • Instagram
  • LinkedIn
  • Twitter
Oct 072011
 

So the next step is to see if I can add picture box / image controls programmatically and set the properties on them.

I managed to get this :

image

With this fairly straightforward bit of code :

PictureBox pbox1 = new PictureBox();
pbox1.Location = new Point(340, 109);
pbox1.Size = new System.Drawing.Size(160, 272);
pbox1.ImageLocation =
    @"C:My Dropboxcode~CodingDocsBackgroundReadingPicture 2.jpg";
pbox1.SizeMode = PictureBoxSizeMode.StretchImage;
pbox1.BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(pbox1);

PictureBox pbox2 = new PictureBox();
pbox2.Location = new Point(640, 109);
pbox2.Size = new System.Drawing.Size(160, 272);
pbox2.ImageLocation =
    @"C:My Dropboxcode~CodingDocsBackgroundReadingPicture 3.jpg";
pbox2.SizeMode = PictureBoxSizeMode.StretchImage;
pbox2.BorderStyle = BorderStyle.FixedSingle;
this.Controls.Add(pbox2);

All it required was quick look on MSDN.  See the reference below.  Now for the hard part.. working out how to divide the screen real estate up into 6 equal sizes, and add the controls and images for those.

    Time Spent So Far : 70 minutes
    References:

http://msdn.microsoft.com/en-us/library/system.windows.forms.pictureboxsizemode.aspx

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)