当前位置: 首页 > news >正文

WPF界面设计-更改按钮样式 自定义字体图标

一、下载图标文件 



iconfont-阿里巴巴矢量图标库

二、xaml界面代码编辑

文件结构

           对应的图标代码

Fonts/#iconfont   对应文件位置

<Window.Resources><ControlTemplate TargetType="Button" x:Key="CloseButtonTemplate"><Grid Background="Transparent" Name="back"><TextBlock Text="&#xe653;" FontFamily="Fonts/#iconfont" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="14"/></Grid><ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="True"><Setter Property="Background" Value="red" TargetName="back"/></Trigger></ControlTemplate.Triggers></ControlTemplate>
</Window.Resources>
<Grid ShowGridLines="True"><Grid.RowDefinitions><RowDefinition Height="30" /><RowDefinition Height="30"/><RowDefinition Height="50"/></Grid.RowDefinitions><Button HorizontalAlignment="Right" Content="X" Margin="0,0,0,0" Width="60" Height="30" BorderThickness="0" Template="{StaticResource CloseButtonTemplate}"/></Grid>

http://www.lryc.cn/news/396736.html

相关文章:

  • 开源项目的机遇与挑战
  • Linux实现CPU物理隔离
  • springer latex模板参考文献不显示
  • 使用Vue3、Pinia和Vite5打造高度还原的抖音仿制项目
  • stm32基本定时器
  • 网络安全基础-1
  • SSH远程访问及控制
  • Qt 绘图详解
  • Python 爬虫与 Java 爬虫:相似之处、不同之处和选项
  • 视频监控汇聚平台LntonCVS视频监控系统解决智慧产业园的安全应用方案
  • MAVLink代码生成-C#
  • 二四、3d人脸构建
  • 鸿蒙开发:Universal Keystore Kit(密钥管理服务)【加解密(C/C++)】
  • Python的入门知识(上)
  • 2024春秋杯网络安全联赛夏季赛-PWN
  • 怎么提高音频声音大小?提高音频声音大小的四种方法
  • 从数据仓库到数据湖(下):热门的数据湖开源框架
  • 对话AI原生 | 千帆AppBuilder重构企业AI原生应用开发体验
  • CF253C Text Editor 题解
  • Spring Boot 创建定时任务
  • Vue使用Echarts(入门级)
  • 2025届秋招提前批信息汇总(计算机类)
  • Scala Collection(集合)
  • Go 语言 UUID 库 google/uuid 源码解析:UUID version4 的实现
  • 开发个人Go-ChatGPT--6 OpenUI
  • Spring中的工厂模式详解及应用示例
  • Electron 简单搭建项目
  • 旗晟智能巡检机器人:开启工业运维的智能化新篇章
  • vue3的常用 Composition API有哪些?
  • 深度优先算法-DFS(算法篇)