PrivateFontCollection p_Font = new PrivateFontCollection();
byte[] b_Font = new byte[WindowsFormsApplication1.Properties.Resources.impact.Length];
IntPtr MeAdd = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * b_Font.Length);
Marshal.Copy(WindowsFormsApplication1.Properties.Resources.impact, 0, MeAdd, WindowsFormsApplication1.Properties.Resources.impact.Length);
p_Font.AddMemoryFont(MeAdd, b_Font.Length);
labelX1.Font = new Font(p_Font.Families[0], 18, FontStyle.Bold | FontStyle.Regular);
其中WindowsFormsApplication1表示程序集
labelX1表示的控件
浙公网安备 33010602011771号