TechTalkz.com Logo

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

Notices

c#:how to install new font?

Programming


Reply
 
Thread Tools Display Modes
Old 13-07-2009, 09:27 AM   #1
Newbie
 
Join Date: Jul 2009
Age: 27
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 lhong1001 is an unknown quantity at this point


OS: Windows XP


c#:how to install new font?

first:i use two functions to install a new font int the following.
AddFontResource("d:\\tmp\\Ni7seg.ttf"); //FilePath为字体WindowsMessages.WM_FONTCHANGE, IntPtr.Zero, IntPtr.Zero);

second:i don't konw how to use the new font.how to set the label's text with the new font?who can give me a example?very thanks
lhong1001 is offline   Reply With Quote
Old 13-07-2009, 09:33 AM   #2
Newbie
 
Join Date: Jul 2009
Age: 27
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 lhong1001 is an unknown quantity at this point


OS: Windows XP


Re: c#:how to install new font?

first:i use two functions to install a new font int the following.
AddFontResource("d:\\tmp\\Ni7seg.ttf"); //FilePath为字体
SendMessage((IntPtr)0xFFFF, WindowsMessages.WM_FONTCHANGE, IntPtr.Zero, IntPtr.Zero);

second:i don't konw how to use the new font.how to set the label's text with the new font?who can give me a example?very thanks
lhong1001 is offline   Reply With Quote
Old 30-07-2009, 08:18 PM   #3
Newbie
 
Join Date: Jul 2009
Location: US
Age: 25
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 0 deazy86 is an unknown quantity at this point


OS: Windows XP


Re: c#:how to install new font?

Try this code see if it works. System.Drawing.Text.PrivateFontCollection pfc = new System.Drawing.Text.PrivateFontCollection();
pfc.AddFontFile("d:\\tmp\\Ni7seg.ttf");
Font myFont = new Font(pfc.Families[0], 80f, FontStyle.Regular, GraphicsUnit.Point, 0);

All the best!!!
deazy86 is offline   Reply With Quote
Reply

Thread Tools
Display Modes



< Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT +5.5. The time now is 04:12 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
Copyright © 2005-2009, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional