如何修改全部DevExpress控件的字体
发布网友
发布时间:2022-05-07 05:44
我来回答
共1个回答
热心网友
时间:2023-10-17 12:51
可以通过修改以下静态属性:
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));
热心网友
时间:2023-10-17 12:51
可以通过修改以下静态属性:
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));
热心网友
时间:2023-10-17 12:51
可以通过修改以下静态属性:
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));