Changing the sizemode of a background image in picturebox
Asked Answered
P

1

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...

Particolored answered 18/4, 2012 at 14:13 Comment(3)
Windows Forms? WPF? Web Forms? Silverlight?Dismount
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.Dismount
PictureBoxSizeMode, BackgroundImageLayout are differents enums for the same purpose. .NET consistency...Jaquelinejaquelyn
L
17

Look at BackgroundImageLayout.
Example:

whatever.BackgroundImageLayout = ImageLayout.Stretch
Locative answered 18/4, 2012 at 14:19 Comment(2)
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. ;)Locative
Use this = whatever // this.BackgroundImageLayout = ImageLayout.Stretch;Jubilate

© 2022 - 2024 — McMap. All rights reserved.