wpf自定义创建图例2(渐变式)

本文介绍如何在WPF中自定义创建带有渐变色的图例。通过在PS中预设渐变色并获取颜色值,然后在WPF前端代码中利用这些值加载图片资源,实现图例的渐变效果。
摘要由CSDN通过智能技术生成

在创建图例时,有时需要绘制渐变色的图例,这样需要先用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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值