码迷,mamicode.com
首页 > 其他好文 > 详细

如何修改全部DevExpress控件的字体

时间:2016-10-20 21:41:56      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

引用:https://www.devexpress.com/Support/Center/Question/Details/A2761

 

You can change the default font used by DevExpress WindowsForms controls with the following static properties:

DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont - Specifies the default font of controls (except menus and toolbars).
DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont - Specifies the default font used by menus and toolbars.
DevExpress.XtraEditors.WindowsFormsSettings.DefaultPrintFont - Specifies the default text font used when printing DevExpress controls.

 

可以通过修改以下静态属性:

DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont - 指定控件的默认字体,除了菜单(menu)和工具栏(toolbar)

DevExpress.XtraEditors.WindowsFormsSettings.DefaultMenuFont - 指定菜单(menu)和工具栏(toolbar)的默认字体

DevExpress.XtraEditors.WindowsFormsSettings.DefaultPrintFont - 指定打印控件(printing)的默认文本字体

[STAThread]
static void Main() {
    DevExpress.XtraEditors.WindowsFormsSettings.DefaultFont = new Font("Courier New", 10);
    Application.Run(new Form1());
}

  

如果想改变某个控件的字体,需要通过设置AppearanceObject.Font属性(通常,外观属性都有名为“Appearance”的字样)

using DevExpress.Utils;
using DevExpress.XtraGrid.Views.Grid;

void SetGridFont(GridView view, Font font) {
    foreach(AppearanceObject ap in view.Appearance)
        ap.Font = font;
}

// USAGE:
SetGridFont(gridView1, new Font("Courier New", 10));

 

如何修改全部DevExpress控件的字体

标签:

原文地址:http://www.cnblogs.com/lukali/p/5982066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!