• 矢量字体图标FontAwesome.WPF


    FontAwesome.WPF是对FontAwesome的封装。可能会比直接使用FontAwesome要方便一点。

    项目网站:https://github.com/charri/Font-Awesome-WPF

    安装:

    Install-Package FontAwesome.WPF

    使用:

    <Window x:Class="Example.FontAwesome.WPF.Single"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:fa="http://schemas.fontawesome.io/icons/"
            Title="Single" Height="300" Width="300">
        <Grid  Margin="20">
            <fa:ImageAwesome Icon="Flag" VerticalAlignment="Center" HorizontalAlignment="Center" />
        </Grid>
    </Window>

    也可以使用以TextBlock为基础的:

    <fa:FontAwesome Icon="Flag" />

    官方的解释:

    The Image based ImageAwesome control is useful when you need to fill an entire space. Whereas the TextBlock base FontAwesome is useful when you need a certain FontSize.

    大概的意思是:ImageAwesome比较适合根据容器填充的地方,FontAwesome适合自己去控制字体大小的地方。

    也可以在一些ContentControl控件上使用,例如下面的Button:

    <Button fa:Awesome.Content="Flag" 
            TextElement.FontFamily="pack://application:,,,/FontAwesome.WPF;component/#FontAwesome"/>

     后台的cs代码中使用:

    Icon = ImageAwesome.CreateImageSource(FontAwesomeIcon.Flag, Brushes.Black);

     一些一直在旋转的图标:

    <fa:ImageAwesome Icon="Spinner" Spin="True" SpinDuration="10" />

    旋转指定角度或翻转图标:

    <fa:ImageAwesome Icon="Spinner" FlipOrientation="Horizontal" Rotation="90" />
  • 相关阅读:
    springboot Quartz 定时任务工具类
    java 发邮件 代码
    spring boot 整合 shiro 权限框架
    java 读取xml
    flowable 报错 Waiting for changelog lock....
    微服务 springcloud Alibaba 阿里组件 项目源码
    Java 读取汉字拼音
    syslog how to
    c++ 字符串总结
    aptget 总结
  • 原文地址:https://www.cnblogs.com/wzwyc/p/14765449.html
Copyright © 2020-2023  润新知