当前位置:网站首页>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
可以直接在应用商店下载
边栏推荐
- Building and sharing the root of the digital world: Alibaba Cloud builds a comprehensive cloud-native open source ecosystem
- sql语句-如何以一个表中的数据为条件据查询另一个表中的数据
- Become a qualified cybersecurity, do you know this?
- @ WebServlet annotations (Servlet annotations)
- 精品MySQL面试题,备战八月99%必问!过不了面试算我的
- My first experience of Go+ language——Blessing message system, so that she can also feel your blessings
- Usage of EFR32 as sniffer for Zigbee/Thread
- WPF recursively obtains the list of specified control types in the form
- MYSQL 唯一约束
- Go 学习笔记(84)— Go 项目目录结构
猜你喜欢
Database Design of Commodity Management System--SQL Server
Perspective transformation matrix of image perspective correction should be matrix (single)/findHomography with getPerspectiveTransformd difference
How to use labelme
七、自定义配置
Simple experiment with BGP
Image stitching (registration) case based on OpenCV
我的Go+语言初体验——祝福留言小系统,让她也可以感受到你的祝福
The Azure developer news 丨 memorabilia in July
MYSQL unique constraint
[MRCTF2020]Hello_misc
随机推荐
@WebServlet注解(Servlet注解)
Golang eight-legged text finishing (continuous handling)
Naive Bayes Classification
Machine Learning: Knowing the Dimensionality Reduction Process Through Low Variance Filtering
POJ1321 棋盘问题(详解)
Discourse Custom Header Links
图像视角矫正之透视变换矩阵(单应矩阵)/findHomography 与 getPerspectiveTransformd的区别
Shanxi group (enterprises) in the second network security skills competition part problem WP (8)
cnpm安装步骤
2.6 Merge Sort
WPF study notes "WPF Layout Basics"
Chapter8 支持向量机
My first experience of Go+ language——Blessing message system, so that she can also feel your blessings
DAY17: weak password detection and test
protobuf 中复合数据类型的读写
Image stitching (registration) case based on OpenCV
MySQL 安装报错的解决方法
cnpm installation steps
MySQL String Concatenation - Various String Concatenation Practical Cases
Simple experiment with BGP