zoukankan      html  css  js  c++  java
  • 使用资源文件(内存)中的字体 或 使用文件中的字体

    // 一、使用资源文件(内存)中的字体
    System.Runtime.InteropServices.GCHandle hObject = System.Runtime.InteropServices.GCHandle.Alloc(Properties.Resources.QuartzMS, System.Runtime.InteropServices.GCHandleType.Pinned);
                IntPtr intptr = hObject.AddrOfPinnedObject();
                System.Drawing.Text.PrivateFontCollection fc = new System.Drawing.Text.PrivateFontCollection();
                fc.AddMemoryFont(intptr, Properties.Resources.QuartzMS.Length);
                Font font1 = new Font(fc.Families[0], 20);
                label1.UseCompatibleTextRendering = true; //这句很关键
                label1.Text = "0123456789";
                label1.Font = font1;
    // 二、使用文件中的字体
    System.Drawing.Text.PrivateFontCollection fc = new System.Drawing.Text.PrivateFontCollection();
                fc.AddFontFile("x:\QuartzMS.ttf");
                Font font1 = new Font(fc.Families[0], 20);
                label1.Text = "0123456789";
                label1.Font = font1;
  • 相关阅读:
    jQ的工具类方法
    jq-ajax
    jq-ajax-get
    LOAD
    JQ的尺寸类
    JQ-DOM与元素的操作
    jQ-DOM属性的操作
    jQ的事件
    3位创业公司CEO亲述:200人的小公司,这么做数据管理就对了
    十二潜意识的智商
  • 原文地址:https://www.cnblogs.com/chengulv/p/4830148.html
Copyright © 2011-2022 走看看