生成选项可以是资源文件和Canvas。使用资源来运用。
app.xaml中:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Pictures/icon.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
icon.xaml中:
1 <?xml version="1.0" encoding="utf-8"?> 2 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 3 <Canvas x:Key="title_icon" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="573" Height="463" Clip="F1 M 0,0L 573,0L 573,463L 0,463L 0,0"> 4 <Rectangle Width="161" Height="247" Canvas.Left="20" Canvas.Top="-1.90735e-005" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFF53F3F"/> 5 <Rectangle Width="399" Height="101" Canvas.Left="90" Canvas.Top="68" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFF53F3F"/> 6 <Rectangle Width="573" Height="117" Canvas.Left="0" Canvas.Top="214" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFF53F3F"/> 7 <Rectangle Width="111" Height="183" Canvas.Left="384" Canvas.Top="270" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFF53F3F"/> 8 <Rectangle Width="151" Height="179" Canvas.Left="44" Canvas.Top="284" Stretch="Fill" StrokeLineJoin="Round" Stroke="#FF000000" Fill="#FFF53F3F"/> 9 </Canvas> 10 </ResourceDictionary>
MainWindow.xaml中:
<Viewbox Margin="3" Child="{StaticResource title_icon}"/>