改变所有的组件字体,使用AppearanceObject.DefaultFont属性:
static void Main()
{
DevExpress.Utils.AppearanceObject.DefaultFont = new Font("华文行楷", 10);
Application.Run(new frmMain());
}
只改变GridView的字体:
using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;
void SetGridFont(GridView view, Font font)
{
foreach(AppearanceObject ap in view.Appearance)
ap.Font = font;
}
// 用法:
SetGridFont(gridView1, new Font(""华文行楷"", 10));