Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Can we show/hide installed fonts in Windows OS using C# in Windows Forms
Is there any class through which we can access a font say "Arial" and hide/show it.

We can manually show/hide a font by right click on the font in the Windows fonts folder
Posted
Comments
John d. Bartels 15-Dec-12 12:08pm    
There is a "FontDialog" class that will show the installed fonts

1 solution

I don't know if I understand your question right.
If you just want to get the installed fonts, there is a class "InstalledFontCollection" derieved from "FontCollection"

C#
string familyName;
string familyList = "";
FontFamily[] fontFamilies;

InstalledFontCollection installedFontCollection = new InstalledFontCollection();

// Get the array of FontFamily objects.
fontFamilies = installedFontCollection.Families;

// The loop below creates a large string that is a comma-separated
// list of all font family names.

int count = fontFamilies.Length;
for (int j = 0; j < count; ++j)
{
    familyName = fontFamilies[j].Name;
    familyList = familyList + familyName;
    familyList = familyList + ",";
}


Hope this is what you wanted to know.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900