使用资源文件(内存)中的字体 或 使用文件中的字体

// 一、使用资源文件(内存)中的字体
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;
原文地址:https://www.cnblogs.com/chengulv/p/4830148.html