.NET 4.x Использование шрифта - C#
Формулировка задачи:
System.Drawing.Text.PrivateFontCollection pfc = new System.Drawing.Text.PrivateFontCollection();
byte[] resf;
resf = Properties.Resources.MicroTech;
System.IO.File.WriteAllBytes("MicroTech.ttf", resf);
pfc.AddFontFile("MicroTech.ttf");
Font myFont = new Font(pfc.Families[0], 8f, FontStyle.Regular, GraphicsUnit.Point, 0);
label1.Font = myFont;
textBox1.Font = myFont;pfc.AddFontFile("MicroTech.ttf");
Получилось исправить так:
InitializeComponent();
byte[] resf;
resf = Properties.Resources.MicroTech;
System.IO.File.WriteAllBytes(@"C:\ThypSon.ttf", resf);
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = false;
System.Drawing.Text.PrivateFontCollection pfc = new System.Drawing.Text.PrivateFontCollection();
System.Threading.Thread.Sleep(20);
pfc.AddFontFile(@"C:\ThypSon.ttf");
Font myFont = new Font(pfc.Families[0], 8f, FontStyle.Regular, GraphicsUnit.Point, 0);
label1.Font = myFont;
textBox1.Font = myFont;
}Решение задачи: «.NET 4.x Использование шрифта»
textual
Листинг программы
MessageBox.Show(Application.StartupPath);