C# 与WPF画布中的BackgroundImageLayout等效?
Windows窗体使我们能够如下设置背景图像的图像布局:C# 与WPF画布中的BackgroundImageLayout等效?,c#,wpf,canvas,C#,Wpf,Canvas,Windows窗体使我们能够如下设置背景图像的图像布局: (GetDesignSurface(tabControl1.SelectedTab) as System.Windows.Forms.UserControl).BackgroundImageLayout = ImageLayout.Center; 现在,我如何在WPF(System.Windows.window)中为画布实现同样的功能 假设ib是一个ImageBrush它提供了两个属性,那么显然没有任何属性允许我实现这一点 获取或设置
(GetDesignSurface(tabControl1.SelectedTab) as System.Windows.Forms.UserControl).BackgroundImageLayout = ImageLayout.Center;
现在,我如何在WPF(System.Windows.window)中为画布实现同样的功能
假设
ib
是一个ImageBrush
它提供了两个属性,那么显然没有任何属性允许我实现这一点
获取或设置TileBrush基本平铺中内容的水平对齐方式
获取或设置TileBrush基本平铺中内容的垂直对齐方式
因此,在您的代码中,您应该能够
ib.AlignmentX = AlignmentX.Center;
ib.AlignmentY = AlignmentY.Center;
您可能还需要将拉伸
,从默认的填充
值设置为无
ib.Stretch = Stretch.None;
ib.Stretch = Stretch.None;