6

My aim was to change the background image and set it's SizeMode as Stretch. Tried a lot so far, any ideas?

EDIT: I am working in C# forms application. Tried simply setting size mode of bg picture:

picturebox1.BackgroundImage = Properties.Resources.Image;
picturebox1.SizeMode = PictureBoxSizeMode.StretchImage;

tried to move around it... no success...

3
  • 1
    Windows Forms? WPF? Web Forms? Silverlight? Apr 18, 2012 at 14:14
  • 1
    And if you want the title to say it all, you should not prefix it with "C# Forms". That's what the tags are for. Apr 18, 2012 at 14:14
  • PictureBoxSizeMode, BackgroundImageLayout are differents enums for the same purpose. .NET consistency...
    – Larry
    Sep 14, 2012 at 7:33

1 Answer 1

17

Look at BackgroundImageLayout.
Example:

whatever.BackgroundImageLayout = ImageLayout.Stretch
2
  • 1
    You're welcome. Next time try to be a bit more specific and show what you have tried from the beginning. It makes it easier for us to help you. And that is what you want. ;)
    – Skalli
    Apr 18, 2012 at 14:27
  • 1
    Use this = whatever // this.BackgroundImageLayout = ImageLayout.Stretch;
    – jmozko
    Sep 27, 2015 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.