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

So the next thing to do is a quick message box type of thing somewhere on the form to output the current maximum window dimensions – I’ll need those later on, but the thought came in to my head to check it now.. so there you go.

The values returned by this :-

MessageBox.Show("Maximum size = " + this.MaximumSize);

Are :

image

Given that my screen is 1366 x 768, then I *think* I have the viewable area in my form.  Time will tell, I guess Smile

The next thing was to plonk an image control on to the form, and put an image in it.  That is fairly easy, and I just set the path (hard coded for now) to :-

pictureBox1.ImageLocation = 
     @"C:My Dropboxcode~CodingDocsBackgroundReadingPicture 1.jpg";
 

    So that’s fine too.
    The problem though is that the image isn’t resized in the window, it’s just part of the original image :

image

      That’s meant to show my iPad screen, the whole of it.  Fortunately there is a SizeMode attribute of the picture control, I thought that AutoSize would do the trick, but that just makes the image huge – not the size that I wanted it.  It turns out the “right” answer is StretchImage :

    image

        So in code I now have :
        pictureBox1.ImageLocation = 
               @"C:My Dropboxcode~CodingDocsBackgroundReadingPicture 1.jpg";
        pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
        pictureBox1.BorderStyle = BorderStyle.FixedSingle;
        Time Spent So Far : 60 minutes
        References:

      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)