[DllImport("kernel32.dll", SetLastError = true)]
static extern int WriteProfileString(string lpszSection, string lpszKeyName, string lpszString); [DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, // handle to destination window
uint Msg, // message
int wParam, // first message parameter
int lParam // second message parameter
); [DllImport("gdi32")]
public static extern int AddFontResource(string lpFileName); private void installFont()
{ string WinFontDir = System.Environment.GetEnvironmentVariable("windir") + "\\fonts";
string FontFileName = "方正北魏楷书简体.TTF";
string FontName = "方正北魏楷书简体";
int Ret;
int Res;
string FontPath;
const int WM_FONTCHANGE = 0x001D;
const int HWND_BROADCAST = 0xffff;
FontPath = WinFontDir + "\\" + FontFileName;
if (!File.Exists(FontPath))
{
File.Copy(System.Windows.Forms.Application.StartupPath + "\\方正北魏楷书简体.ttf", FontPath);
Ret = AddFontResource(FontPath); Res = SendMessage(HWND_BROADCAST, WM_FONTCHANGE, , );
Ret = WriteProfileString("fonts", FontName + "(TrueType)", FontFileName);
} }

c# 字体安装的更多相关文章

  1. Ubuntu系统字体安装

    用惯了Windows,刚转到Ubuntu时总感觉字体显示没那么亲切,尤其是中文字体,在网页上显示特别怪.有些软件对中文字体的支持也不好,WebStorm中的Git logs中文也显示乱码.把系统语言设 ...

  2. Windows、mac字体安装教程

    请问字体如何安装? Win7.8.10安装字体方法: http://jingyan.baidu.com/article/14bd256e27c517bb6c26127c.html mac安装字体方法: ...

  3. $\TeX$ Gyre 字体安装过程与问题解决

    目录 安装过程 1. 下载字体包 2. 安装字体 3. 测试范例文件 本文地址 https://www.cnblogs.com/oberon-zjt0806/p/13672426.html 本文只是一 ...

  4. Debian 8.3 中文字体安装

    有了这个字体,对于日常工作和生活而言已经非常足够了.如果你还需要更多中文字体的话,推荐可以安装“文泉驿正黑”,“文泉驿点阵宋体”等.文泉驿的安装包已经进入了 Debian/Ubuntu,直接安装 tt ...

  5. Ubuntu 字体安装

    命令安装:   以微软雅黑字体为例(其他的宋体.黑体等点阵字体都一样的),我们的雅黑字体文件是:Yahei.ttf(放在自己的主目录下)(在widows目录的Fonts目录下找需要的字体)由于我是双系 ...

  6. linux字体安装

    Google查了一下,果然Windows下的ttf字体与GNOME是兼容的!我立即确定了我的方案——使用Windows下的“微软雅黑”体作为桌面和应用程序的默认字体! 1. 首先获得一套“微软雅黑”字 ...

  7. 将texlive带的字体安装进linux系统字体库

    装机之后装系统,装完系统就装texlive,然后又遇一坑,编译以前的文档竟然找不到某字体: kpathsea:make_tex: Invalid fontname `FontAwesome Regul ...

  8. HACK字体安装

    参考:https://github.com/source-foundry/Hack Linux的 下载最新版本的Hack. 从存档中提取文件(.zip). 将字体文件复制到系统字体文件夹(通常/usr ...

  9. odoo开发笔记 -- wkhtmltox打印不显示中文 --ubuntu字体安装

    wkhtmltox 是一个开源的将网页内容转换成PDF的软件包,常嵌套在网页页面里边做打印功能. 以微软雅黑字体为例(其他的宋体.黑体等点阵字体都一样的),我们的雅黑字体文件是:Yahei.ttf(放 ...

  10. wps for linux 安装后系统缺失字体安装配置

    错误提示: 解决方法: 从http://bbs.wps.cn/thread-22355435-1-1.html下载字体库,离线版本:(链接: https://pan.baidu.com/s/1i5dz ...

随机推荐

  1. python学习之路-day5-模块

    本节内容: 模块详解 1.模块定义 2.os&sys模块 3.time&datetime模块 4.random模块 5.shutil模块 6.shelve模块 7.configpars ...

  2. android设置多个类似APP其中的一个为默认

    05-09 17:01:13.547: I/ActivityManager(3003): START u0 {act=android.intent.action.VIEW cat=[android.i ...

  3. BigDecimal 运算

    BigDecimal类 双精度浮点型变量double可以处理16位有效数.在实际应用中,需要对更大或者更小的数进行运算和处理.Java在java.math包中提供的API类BigDecimal,用来对 ...

  4. Redis在CentOS6.4中的安装

    首先,介绍一下Redis数据库.Redis是一种面向“键/值”对数据类型的内存数据库,可以满足我们对海量数据的读写需求. 1)redis的键只能是字符串: 2)redis的值支持多种数据类型: a:字 ...

  5. Excel VBA自动添加证书

    ---恢复内容开始--- 在说这个话题之前,我先解释一下为什么要加数字证书签名,它有什么作用,后面再解释如何添加.首先解释下证书添加的位置,如下图所示: 1.单击左上角的Office 按钮,选择右下角 ...

  6. spring-data-elasticsearch整合elasticsearch

    花了一个晚上 整合最新版本的spring-data-elasticsearch与elasticsearch,遇到各种版本冲突 之类的问题,测试效果如图: facet搜索:

  7. git clone 错误ca-certificates.crt

    git clone https://github.com/baoyiluo/selfblog.git Cloning into 'selfblog'... error: server certific ...

  8. 解决修改密码报错‘passwd:Authentication token’

     1.修改密码时报错: 错误信息:'passwd: Authentication token manipulation error' [root@localhost test]# ' | passwd ...

  9. iOS中数字的格式化 NSNumberFormatter

    NSNumberFormatter 和NSDateFormatter 是NsFormatter的子类. NSNumberFormatter类有个属性numberStyle,它是一个枚举型,设置不同的值 ...

  10. 根据Url 获取图片尺寸 iOS

    // 根据图片url获取图片尺寸 +(CGSize)getImageSizeWithURL:(id)imageURL {     NSURL* URL = nil;     if([imageURL ...