zoukankan      html  css  js  c++  java
  • wpf 使用Font-Awesome图标字体

    wpf 使用Font-Awesome图标字体

    1、http://fontawesome.io/ 中下载Font-Awesome字体

    然后把字体文件fontawesome-webfont.ttf 拷贝到项目中

    build action 设置为Resource

    并设置“复制到输出目录”为“如果较新则复制” 或者 copy always

    所有图标对应的值内容地址

    http://www.bootcss.com/p/font-awesome/design.html

    <Window x:Class="WpfApplication1.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow"> 
    <Window.Resources> 
    <Style x:Key="FontAwesome">
    <Setter Property="TextElement.FontFamily" Value="pack://application:,,,/#FontAwesome" />
    <Setter Property="TextBlock.Width" Value="100"></Setter>
    <Setter Property="TextBlock.Height" Value="100"></Setter>
    <Setter Property="TextBlock.TextAlignment" Value="Center"></Setter>
    <Setter Property="TextBlock.FontSize" Value="60"></Setter>
    <Setter Property="TextBlock.Foreground" Value="Green"></Setter>
    </Style>
    </Window.Resources> 
    <WrapPanel Margin="12"> 
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    <TextBlock Text="&#xf01a;" Style="{DynamicResource FontAwesome}" />
    </WrapPanel> 
    </Window>
     
    
  • 相关阅读:
    教你玩转CSS的所有字体,路过的来瞧一瞧。
    CSS基本语法?
    怎么样才能玩转前端所有的CSS背景相关问题?
    如何玩转CSS内部样式表与外部样式表?
    什么是CSS?你真的理解了吗?
    CSS页面demo
    HTML教程(看完这篇就够了)
    HTML5新增的主体结构元素
    Math
    练习点菜及用的公式
  • 原文地址:https://www.cnblogs.com/z_lb/p/7803934.html
Copyright © 2011-2022 走看看