2011-12-28 134 views
1

我想放置一個圖像在面板中,但我不希望它根據面板的大小重複。面板背景圖像重複C#

我所做的是:

panel3.BackgroundImage = picture1; 

然而,圖片1重複幾次,由於面板比實際畫面更爲廣闊。

我想要的只是以其原始形式顯示圖片。我不想重複它。

我該怎麼做?由於

回答

3

嘗試

panel3.BackgroundImageLayout = ImageLayout.Stretch; 

這將停止repeatition並拉伸圖像整體面板。如果您不想讓圖像伸展嘗試ImageLayout.Center

1

您可以將BackgroundImageLayout設置爲Center

3
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)