Пример #1
0
        public static Font GetFontDataAsMediaFont(FontEnum fontName = FontEnum.BNazanin)
        {
            if (_fonts != null)
            {
                var height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;
                var width  = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

                FontEnum adaptableFont = fontName;

                if (width >= 1366 && height >= 768)
                {
                    adaptableFont = FontEnum.BYekan;
                }
                foreach (var item in _fonts.Families)
                {
                    if (item.Name.ToLower().Trim().Replace(" ", "").Equals(adaptableFont.ToString().ToLower().Trim().Replace(" ", "")))
                    {
                        return(new Font(
                                   new FontFamily(item.Name),
                                   13,
                                   FontStyle.Regular,
                                   GraphicsUnit.Pixel));
                    }
                }
            }
            return(new Font("Tahoma", 10));
        }
Пример #2
0
 public static System.Drawing.FontFamily GetFontData(FontEnum fontName = FontEnum.BNazanin)
 {
     if (_fonts != null)
     {
         foreach (var item in _fonts.Families)
         {
             if (item.Name.ToLower().Trim().Replace(" ", "").Equals(fontName.ToString().ToLower().Trim().Replace(" ", "")))
             {
                 return(item);
             }
         }
     }
     return(new System.Drawing.Font("Tahoma", 10).FontFamily);
 }