Code Bye

Devexpress中统一设置字体样式的方法

Devexpress 统一设置Winform程序字体样式可以在Program的main方法中设置
#region 设置默认字体、日期格式、汉化dev
DevExpress.Utils.AppearanceObject.DefaultFont = new System.Drawing.Font(“Tahoma”, 9);
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(“zh-CHS”);//使用DEV汉化资源文件
//设置程序区域语言设置中日期格式
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(“zh-CHS”);
System.Globalization.DateTimeFormatInfo di = (System.Globalization.DateTimeFormatInfo)System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.Clone();
di.DateSeparator = “-“;
di.ShortDatePattern = “yyyy-MM-dd”;
di.LongDatePattern = “yyyy”年”M”月”d”日””;
di.ShortTimePattern = “H:mm:ss”;
di.LongTimePattern = “H”时”mm”分”ss”秒””;
ci.DateTimeFormat = di;
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
#endregion
还可以设置
WindowsFormsSettings.DefaultFont = new Font(“Segoe UI”, fontSize);
WindowsFormsSettings.DefaultMenuFont = new Font(“Segoe UI”, fontSize);
之后Devexpress 程序中字体都会发生变化。


CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Devexpress中统一设置字体样式的方法