在创建图例时,有时需要绘制渐变色的图例,这样需要先用PS调出一个渐变色图片,通过工具获取到渐变色值设置,然后通过wpf创建图例,加载图片资源标记颜色对应值
wpf前端代码:
<Window x:Class="WpfToolTest.ColorLegendCommon"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ColorLegendCommon" Height="502" Width="112"
AllowsTransparency="True" Background="Transparent" Opacity="0.8"
WindowStyle="None" Topmost="True" ShowInTaskbar="False"
AllowDrop="True" MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.Resources>
<Style x:Key="lab_Style" TargetType="Label">
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Height" Value="25"></Setter>
<Setter Property="Width" Value="70"></Setter>
</Style>
<Style x:Key="title_Style" TargetType="Label">
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="FontWeight" Value="Bold"></Sett