面板背景图像重复C#

问题描述:

我想放置一个图像在面板中,但我不希望它根据面板的大小重复。面板背景图像重复C#

我所做的是:

panel3.BackgroundImage = picture1; 

然而,图片1重复几次,由于面板比实际画面更为广阔。

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

我该怎么做?由于

尝试

panel3.BackgroundImageLayout = ImageLayout.Stretch; 

这将停止repeatition并拉伸图像整体面板。如果您不想让图像伸展尝试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)