Csharp/C#教程:PrivateFontCollection给我符号分享


PrivateFontCollection给我符号

我正在使用添加字体

  GCHandle pinnedArray = GCHandle.Alloc(data,GCHandleType.Pinned);  IntPtr pointer = pinnedArray.AddrOfPinnedObject();  CustomFonts.Fonts.AddMemoryFont(pointer,data.Length);  pinnedArray.Free(); 

但是当我将它用于标签时,它只会显示为一堆字母(运行时)。 我打开了CompatibleTextRendering。 我想嵌入“访客”。 当我使用它而不嵌入它,它工作正常。 但我想嵌入它,因为它不是标准字体。

编辑:

只是尝试使用AddFile,这是有效的。 不知道为什么从内存中添加它是失败的。

显然AddMemoryFont没有进行额外的api调用。

上述就是C#学习教程:PrivateFontCollection给我符号分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

  [的DllImport( “GDI32.DLL”)]  private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont,uint cbFont,IntPtr pdv,[In] ref uint pcFonts);   GCHandle pinnedArray = GCHandle.Alloc(data,GCHandleType.Pinned);  IntPtr pointer = pinnedArray.AddrOfPinnedObject();  CustomFonts.Fonts.AddMemoryFont(pointer,data.Length);  uint dummy = 0;  AddFontMemResourceEx((IntPtr)指针,(uint)data.Length,IntPtr.Zero,ref dummy);  pinnedArray.Free(); 

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/962278.html

(0)
上一篇 2021年11月26日
下一篇 2021年11月26日

精彩推荐