当前位置:网站首页>WPF introduces ttf icon file usage record
WPF introduces ttf icon file usage record
2022-07-30 04:37:00 【solar storm】
导言:记录一下 WPF 下面使用 ttf A record of the icon file
一、下载图标文件
1. 图标网站
链接地址: https://www.iconfont.cn/
2. 下载图标
Tick to cart
下载代码 即可
这里有个小技巧
在按 F12 打开控制台 Enter the following code in the console,It will automatically be added to your favorites
var span = document.querySelectorAll('.icon-cover');
for (var i = 0, len = span.length; i < len; i++) {
console.log(span[i].querySelector('span').click());
}

下载的文件如下图
打开demo_index.html文件
UnicodeThe column corresponds to the following characters is the corresponding icon
二、WPF使用
1. 准备工作
上面的 iconfont.ttf The file is what we need to use
Copy this file to the project directory,I've added several here 这样的文件,也是为了测试
Open the font file,可以看到其 字体名字 : iconfont
This name is what our project uses
2. 项目使用
在 Add the following code under the resource file path,This resource can be placed directly App.xml 里面可以,It can also be placed in the resources of the window.
<!-- 模板 <FontFamily x:Key="IconFont"> Pack://application:,,,/你的程序名;component/Path to font file/#字体名 </FontFamily> -->
<FontFamily x:Key="IconFont">
Pack://application:,,,/EventLearn;component/Rescourses/#iconfont
</FontFamily>
<FontFamily x:Key="PanuonIcon">
Pack://application:,,,/EventLearn;component/Rescourses/#PanuonIcon
</FontFamily>
- 你的程序名 It can be seen in the project properties

- Path to font file It is the path from the project root directory
- 字体名 That's what I said before to open itttffile font name,not the same as the file name
3. 代码使用
在 mainwindow.xamlIt is imported as follows
<TextBlock Foreground="BlueViolet" Grid.Row="3" Grid.Column="1" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="{StaticResource IconFont}" Text=""/>
<TextBlock Foreground="BlueViolet" Grid.Row="3" Grid.Column="0" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" FontFamily="{StaticResource PanuonIcon}" Text=""/>
效果如图下
Icons can be downloaded as before demo_index.html里面查看
也可以去 Look inside the icon viewing software,I use this software called Character Map
可以直接在应用商店下载

边栏推荐
- 共建共享数字世界的根:阿里云打造全面的云原生开源生态
- Naive Bayes Classification
- 精品MySQL面试题,备战八月99%必问!过不了面试算我的
- cnpm安装步骤
- Machine Learning: Knowing the Dimensionality Reduction Process Through Low Variance Filtering
- MNIST of Dataset: MNIST (handwritten digital image recognition + ubyte.gz file) data set introduction, download, usage (including data enhancement) detailed guide
- Solve the error SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb7 in position 0: invalid start b
- 【软件工程之美 - 专栏笔记】31 | 软件测试要为产品质量负责吗?
- 2.6 Radix sort (bucket sort)
- Catch That Cow(详解)
猜你喜欢

2.5快速排序
![[MRCTF2020]Hello_ misc](/img/ea/0faacf6e544b60e3459d8ace4d5f42.png)
[MRCTF2020]Hello_ misc

@WebServlet注解(Servlet注解)

MySQL 操作语句大全(详细)

sql statement - how to query data in another table based on the data in one table

Excellent MySQL interview questions, 99% must ask in preparation for August!I can't pass the interview

DAY17: weak password detection and test

1. Get data - requests.get()

DAY17, CSRF vulnerability

Chapter8 Support Vector Machines
随机推荐
Unity3D Application simulation enters the front and background and pauses
file system two
error: The following untracked working tree files would be overwritten by
Classification of decision tree classification
Chapter8 支持向量机
See you in shenzhen!Cloud native to accelerate the application building special: see cloud native FinOps, SRE, high-performance computing scenario best practices
MYSQL unique constraint
WPF study notes "WPF Layout Basics"
Mini Program wx.miniProgram.navigateTo jump address cannot be tabbar address
2.4希尔排序
A brief introduction to the SSM framework
Verify that the addShutdownHook hook takes effect
05全局配置文件application.properties详解
商品管理系统数据库设计--SQL Server
DAY17:弱口令的探测与测试
Simulation Problem (Part 1)
cnpm安装步骤
Double pointer problem (middle)
【翻译】Envoy Fundamentals,这是一个培训课程,使人们能够更快地采用Envoy Proxy。...
Web page element parsing a tag