C# winForm. 如何使用系统中没有安装的字体,比如我想使用微软雅黑字体.可这种字体在XP上没有安装,怎么办?
字体文件以资源的形式出现 编译在.EXE文件中
PrivateFontCollection p_Font = new PrivateFontCollection();
byte[] b_Font = new byte[Mentalarithmetic.Properties.Resources.DS_DIGIT.Length];
IntPtr MeAdd = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * b_Font.Length);
Marshal.Copy(Mentalarithmetic.Properties.Resources.DS_DIGIT, 0, MeAdd, Mentalarithmetic.Properties.Resources.DS_DIGIT.Length);
p_Font.AddMemoryFont(MeAdd, b_Font.Length);
m_ShowNumber.Font = new Font(p_Font.Families[0],18,FontStyle.Bold|FontStyle.Regular);