如何设置的PNG图片作为我的WPF窗体平铺背景图片? [英] How to set a .PNG image as a TILED background image for my WPF Form?
本文介绍了如何设置的PNG图片作为我的WPF窗体平铺背景图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对我自己的学习WPF和我似乎无法找到一种方法,使这项工作。
I'm learning WPF on my own and I can't seem to find a way to make this work.
下面是我的code:
<Window x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="600" Width="800" >
<DockPanel>
<Menu DockPanel.Dock="Right"
Height="30"
VerticalAlignment="Top"
Background="#2E404B"
BorderThickness="2.6">
<Menu.BitmapEffect>
<DropShadowBitmapEffect Direction="270" ShadowDepth="3" Color="#2B3841"/>
</Menu.BitmapEffect>
</Menu>
</DockPanel>
我怎样才能让一个平铺的背景图像出现?
How can I make a tiled background image appear?
推荐答案
或者,也许你可以使用的视觉刷:
Or, perhaps, you could use Visual Brush:
<Window
x:Class="Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test" Height="600" Width="800">
<Window.Background>
<VisualBrush TileMode="Tile" Viewport="0,0,0.5,0.5">
<VisualBrush.Visual>
<Image Source="image.png"></Image>
</VisualBrush.Visual>
</VisualBrush>
</Window.Background>
</Window>
这篇关于如何设置的PNG图片作为我的WPF窗体平铺背景图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文