当前位置:网站首页>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
可以直接在应用商店下载

边栏推荐
- Introduction to database - MySQL simple introduction
- 2.5快速排序
- 2.4希尔排序
- Chapter8 支持向量机
- 成为一个合格的网安,你知道这些吗?
- The 2nd Shanxi Province Network Security Skills Competition (Enterprise Group) Partial WP (10)
- 2.4 hill sorting
- Code open source design and implementation ideas
- - B + tree index and MySQL series 】 【 what is the difference between a HASH index
- Shanxi group (enterprises) in the second network security skills competition part problem WP (7)
猜你喜欢

2.5 Quick Sort

Discourse Custom Header Links

golang八股文整理(持续搬运)

Solve the error SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xb7 in position 0: invalid start b

图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别

KubeMeet Registration | The complete agenda of the "Edge Native" Online Technology Salon has been announced!

3. Dependency configuration management

webService接口

Classification of decision tree classification

DAY17:弱口令的探测与测试
随机推荐
Repetition XXL - JOB scheduling center background arbitrary command execution
Simulation Problem (Part 1)
labelme的使用技巧
Thinkphp 5.0.24 Variable Override Vulnerability Causes RCE Analysis
双指针问题(上)
(题目练习)条件概率+权值线段树+FWT+后缀数组
代码开源设计实现思路
【Redis高手修炼之路】Jedis——Jedis的基本使用
解决报错SyntaxError: (unicode error) ‘utf-8‘ codec can‘t decode byte 0xb7 in position 0: invalid start b
Stimulsoft ReportsJS and DashboardsJS. 2022.3.3
Go 学习笔记(84)— Go 项目目录结构
Discourse 自定义头部链接(Custom Header Links)
The Complete Go Books - Beginner to Advanced and Web Development
精品MySQL面试题,备战八月99%必问!过不了面试算我的
sql statement - how to query data in another table based on the data in one table
MySql 怎么查出符合条件的最新的数据行?
Thymeleaf简介
webService接口
Get the local IP and Request's IP
Learning of redis_Basic part