一、运行效果图

二、图标字体文件下载

http://fontawesome.dashgame.com/(这个网址可以下载图标字体文件)

http://www.fontawesome.com.cn/(这个网址可以下载图标字体文件和查图标编码)

(2)解压文件,复制文件备用。

(3)查图标编号

二、开始WPF项目

(1)新建Windows Desktop下的WPF Application项目.

(2)新建Resources文件夹,复制fontawesome-webfont.ttf文件进去.

(3)编辑MainWindow.xaml文件

<Window x:Class="LearnWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" Background="#1874CD"> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="" FontSize="80" Margin="3" FontFamily="/LearnWPF;component/Resources/#FontAwesome" Foreground="#CF1FFF"></TextBlock>
<TextBlock Text="" FontSize="80" Margin="3" FontFamily="/LearnWPF;component/Resources/#FontAwesome" Foreground="#1FFFFF"></TextBlock>
<TextBlock Text="" FontSize="80" Margin="3" FontFamily="/LearnWPF;component/Resources/#FontAwesome" Foreground="#FFFFFF"></TextBlock>
<TextBlock Text="" FontSize="80" Margin="3" FontFamily="/LearnWPF;component/Resources/#FontAwesome" Foreground="#FB0AE8"></TextBlock>
</StackPanel>
</Window>

  (4)运行结果

(5)改进

 <Window x:Class="LearnWPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="" Width="" Background="#1874CD">
<Window.Resources>
<Style x:Key="FontAwesome" TargetType="TextBlock">
<Setter Property="FontSize" Value=""/>
<Setter Property="Margin" Value=""/>
<Setter Property="FontFamily" Value="/LearnWPF;component/Resources/#FontAwesome"></Setter>
</Style>
</Window.Resources>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Text="" Style="{StaticResource FontAwesome}" Foreground="#CF1FFF"></TextBlock>
<TextBlock Text="" Style="{StaticResource FontAwesome}" Foreground="#1FFFFF"></TextBlock>
<TextBlock Text="" Style="{StaticResource FontAwesome}" Foreground="#FFFFFF"></TextBlock>
<TextBlock Text="" Style="{StaticResource FontAwesome}" Foreground="#FB0AE8"></TextBlock>
</StackPanel>
</Window>

学习WPF——使用Font-Awesome图标字体(一)的更多相关文章

  1. 在WPF中使用FontAwesome图标字体

    原文:在WPF中使用FontAwesome图标字体 版权声明:原创内容转载必须注明出处,否则追究相关责任. https://blog.csdn.net/qq_36663276/article/deta ...

  2. Font Awesome图标字体应用及相关

    作为web开发者,难免要经常要用到些小图标,给自己web增添几分活力和多样性.像这些: 而Font Awesome刚好为我们提供了这些.到目前为止,Font Awesome提供了有500多个可缩放的的 ...

  3. Font Awesome:图标字体,完全CSS控制

    Font Awesome是一种web font,它包含了几乎所有常用的图标,比如Twitter.facebook等等.用户可以自定义这些图标字体,包括大小.颜色.阴影效果以及其它可以通过CSS控制的属 ...

  4. font awesome (图标字体库)

    Font Awesome fa是什么? 图标字体库和CSS框架 怎么用? <link rel="stylesheet" href="https://cdn.boot ...

  5. Font Awesome图标字体库(2015年05月25日)

    Font Awesome是一款非常棒的字体图标工具,给个地址,具体的自已慢慢去体会,只能帮你到这儿了...... http://fortawesome.github.io/Font-Awesome/ ...

  6. Font Awesome图标字体

    1.unicode unicode是字体在网页端最原始的应用方式,特点是: 兼容性最好,支持ie6+,及所有现代浏览器. 支持按字体的方式去动态调整图标大小,颜色等等. 但是因为是字体,所以不支持多色 ...

  7. CSS网页使用Font Awesome图标字体时,css定义 content 属性

    原文地址: http://blog.csdn.net/laurel_y/article/details/70842157

  8. 学习WPF——使用Font-Awesome图标字体

    图标字体介绍 在介绍图标字体之前,不得不介绍图标格式ICON ICON是一种图标格式,我们操作系统中各种应用程序都包含一个图标 比如QQ程序的图标是一个可爱的企鹅,我的电脑是一个显示器图标 ----- ...

  9. 01_MUI之Boilerplate中:HTML5示例,动态组件,自定义字体示例,自定义字体示例,图标字体示例

     1安装HBuilder5.0.0,安装后的界面截图如下: 2 按照https://www.muicss.com/docs/v1/css-js/boilerplate-html中的说明,创建上图的 ...

  10. IconMoon图标字体制作

    官网:https://icomoon.io/ 点击右上角“IconMoon APP” 点击左上角“import Icons”按钮 选中小图标 - 选择右下角“Generate Font”生成图标字体 ...

随机推荐

  1. python函数作用域,嵌套函数,闭包

    函数作用域                                                                                                ...

  2. centos7使用rpm方式安装mysql

    https://blog.csdn.net/smiles13/article/details/81460617    (部分参考) 先查看是否安装mariadb rpm -qa | grep mari ...

  3. Laravel数据库操作 Eloquent ORM

    模型首先在App目录下建立student的文件夹 里面放上 Student.php 且需要继承基类Model //允许批量赋值的字段// protected $fillable = ['name',' ...

  4. DRF框架之 serializers 序列化组件

    1. 什么是序列化,其实在python中我们就学了序列化工具json工具,就是吧信息存为类字典形式 2. DRF框架自带序列化的工具: serializers 3. DRF框架 serializers ...

  5. MySql:SELECT 语句(一)基本查询

    1.检索单个列 语句:SELECT col FROM tablename; 2.检索多个列 语句:SELECT col1, col2 FROM tablename; 3.检索所有列 使用 * 通配符. ...

  6. ViewParent 和 ViewManager

    ViewGroup 继承了 View  实现了两个接口  ViewParent 和 ViewManager 接口 ViewParent:定义了成为一个View的parent的一些“职能”,当paren ...

  7. 35.Spring-jdbc支持.md

    目录 1.JdbcTemplate类 1.1导入jar包 1.2创建Dao对象 1.3将上述例子封装后 2. 3. 1.JdbcTemplate类 传统的jdbc开始,需要对Connection.St ...

  8. springcloud-知识点总结(三):Hystrix & Dashboard & turbine & Zuul & SpringCloud Config

    1.Hystrix断路器简介 Hystrix断路器简介 hystrix对应的中文名字是“豪猪”,豪猪周身长满了刺,能保护自己不受天敌的伤害,代表了一种防御机制,这与hystrix本身的功能不谋而合,因 ...

  9. 安装Python-Jenkins

    有两种方式安装: ①有网络:sudo pip install python-jenkins ②无网络: 下载文件:https://pypi.org/project/python-jenkins/#fi ...

  10. [leetcode]77. Combinations组合

    Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. Example: I ...