zoukankan      html  css  js  c++  java
  • 矢量字体图标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" />
  • 相关阅读:
    Core Animation简介
    objective-c 常用函数、变量
    NSString判断纯数字
    自定义对话框AlterView
    IOS 6 自动布局 入门-1(IOS中autolayout和之前版本autoresize的差异)
    真机调试问题 错误集合
    block使用小结、在arc中使用block、如何防止循环引用
    View和viewController的生命周期
    IOS侧滑和webview
    Linker Error、MRC与ARC、导航条背景
  • 原文地址:https://www.cnblogs.com/wzwyc/p/14765449.html
Copyright © 2011-2022 走看看