1

使用 C#,如何设置背景图片的 TileMode 和 Stretch 属性?

StackPanel1.Background = new ImageBrush(new ....); // OK
StackPanel1.Background = Stretch.Uniform; //this doesn't work...

4

1 回答 1

2

需要在图像画笔本身上设置属性。

var imageBrush = new ImageBrush();
imageBrush.Stretch = Stretch.Uniform;
StackPanel1.Background = imageBrush;
于 2011-06-28T06:39:43.827 回答