Как мне встроить собственные шрифты в приложение WinForms?
// specify embedded resource name string resource = "embedded_font.PAGAP___.TTF"; // receive resource stream Stream fontStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource); // create an unsafe memory block for the font data System.IntPtr data = Marshal.AllocCoTaskMem((int)fontStream.Length); // create a buffer to read in to byte[] fontdata = new byte[fontStream.Length]; // read the font data from the resource fontStream.Read(fontdata, 0, (int)fontStream.Length); // copy the bytes to the unsafe memory block Marshal.Copy(fontdata, 0, data, (int)fontStream.Length); // pass the font to the font collection private_fonts.AddMemoryFont(data, (int)fontStream.Length); // close the resource stream fontStream.Close(); // free up the unsafe memory Marshal.FreeCoTaskMem(data);
c#.net
c#
fonts
embedding
2021-12-15T13:08:29+00:00
2022-11-14T04:05:40+00:00
UkrainaMama
Вопросы с похожей тематикой, как у вопроса:
Как мне встроить собственные шрифты в приложение WinForms?
Предупреждение о файлах Cookies
Мы используем файлы cookies для улучшения работы сайта. Оставаясь на нашем сайте, вы соглашаетесь с условиями использования файлов cookies. Чтобы ознакомиться с нашими Положениями о конфиденциальности и об использовании файлов cookie, нажмите здесь.