Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
面板背景图像重复C#_C#_Image_Panel - Fatal编程技术网

面板背景图像重复C#

面板背景图像重复C#,c#,image,panel,C#,Image,Panel,我想在面板中放置一个图像,但我不想根据面板的大小重复它 我所做的是: panel3.BackgroundImage = picture1; 但是,图1重复了几次,因为面板比实际图片宽得多 我想要的是仅以原始形式显示图片。我不想让它重复 我该怎么做?谢谢试试看 panel3.BackgroundImageLayout = ImageLayout.Stretch; 这将停止重复并将图像拉伸到整个面板。如果不希望图像拉伸,请尝试ImageLayout.Center您可以将BackgroundIma

我想在面板中放置一个图像,但我不想根据面板的大小重复它

我所做的是:

panel3.BackgroundImage = picture1;
但是,图1重复了几次,因为面板比实际图片宽得多

我想要的是仅以原始形式显示图片。我不想让它重复

我该怎么做?谢谢

试试看

panel3.BackgroundImageLayout = ImageLayout.Stretch;

这将停止重复并将图像拉伸到整个面板。如果不希望图像拉伸,请尝试
ImageLayout.Center

您可以将
BackgroundImageLayout
设置为
Center

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)