Panel Background Image Repetition C#

16,219

Solution 1

ImageLayout.Stretch; //make Image Fill the Control 
ImageLayout.None; //just put the image without any changes on size
ImageLayout.Center; //adjust location of image to be centered
ImageLayout.Tile; //repeat image
ImageLayout.Zoom; //re size image to be all viewed in the control (without stretch)

Solution 2

try

panel3.BackgroundImageLayout = ImageLayout.Stretch;

this will stop repeatition and will stretch image to whole panel. If you don't want image to stretch Try ImageLayout.Center

Solution 3

You can set BackgroundImageLayout to Center.

Share:
16,219
Clayton
Author by

Clayton

Updated on June 17, 2022

Comments

  • Clayton
    Clayton over 1 year

    I want to place an image in a panel, but I do not want it repeated according to the size of the panel.

    What I did is this:

    panel3.BackgroundImage = picture1;
    

    However, picture1 is repeated several times, since the panel is much wider than the actual picture.

    What I want is to display the picture in its original form only. I don't want it repeated.

    How can I do this? Thanks