mardi 12 juillet 2016

How to generate Random Font in C#?

i am trying to generate a random font on a label. Thats my work so far:

         string[] ArrFont = new String[999];
         InstalledFontCollection ifc = new InstalledFontCollection();
         FontFamily[] ffs = ifc.Families;
         //Font f;
         int runs=0;

         foreach (FontFamily ff in ffs)
         {
             runs++;
             ArrFont[runs] = ff.ToString();

         }
        Font font = new Font(FontStyle(ran.Next(1, 400), FontStyle.Regular);

        label1.Font = font;

Can anyone help me please?




Aucun commentaire:

Enregistrer un commentaire