如何让devexpress gridcontrol的indicator显示文字加粗
How to make devexpress gridcontrol's indicator display text bold
如何在devexpress gridcontrol的指示器中将显示文本设为粗体?
在这里更改指示器单元格样式也会更改背景颜色。但我只想使指示器单元格显示文本为粗体,并使用默认背景色。
e.Appearance.FillRectangle(e.Cache, e.Bounds);
e.Appearance.DrawString(e.Cache, e.Info.DisplayText, e.Bounds,
new Font(e.Appearance.Font.FontFamily,10,FontStyle.Bold),
new StringFormat());
e.Handled = true;
我们使用这个代码:
_gridView.RowCellStyle += GridViewRowCellStyle;
void GridViewRowCellStyle(object sender, RowCellStyleEventArgs e)
{
FontStyle fs = e.Appearance.Font.Style;
fs |= FontStyle.Bold;
e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
如果您有编辑器,请添加:
_gridView.ShownEditor += GridViewShownEditor;
void GridViewShownEditor(object sender, EventArgs e)
{
FontStyle fs = _gridView.ActiveEditor.Font.Style;
fs |= FontStyle.Bold;
_gridView.ActiveEditor.Font = new Font(_gridView.ActiveEditor.Font, fs);
}
指标相同:
_gridView.CustomDrawRowIndicator += GridViewCustomDrawRowIndicator;
void GridViewCustomDrawRowIndicator(object sender, EventArgs e)
{
FontStyle fs = e.Appearance.Font.Style;
fs |= FontStyle.Bold;
e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
您可以在网格中设置焦点行的样式。 Grid => GridView => Appearance => FocusedRow => Font => Bold 设置为 true.
如何在devexpress gridcontrol的指示器中将显示文本设为粗体?
在这里更改指示器单元格样式也会更改背景颜色。但我只想使指示器单元格显示文本为粗体,并使用默认背景色。
e.Appearance.FillRectangle(e.Cache, e.Bounds);
e.Appearance.DrawString(e.Cache, e.Info.DisplayText, e.Bounds,
new Font(e.Appearance.Font.FontFamily,10,FontStyle.Bold),
new StringFormat());
e.Handled = true;
我们使用这个代码:
_gridView.RowCellStyle += GridViewRowCellStyle;
void GridViewRowCellStyle(object sender, RowCellStyleEventArgs e)
{
FontStyle fs = e.Appearance.Font.Style;
fs |= FontStyle.Bold;
e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
如果您有编辑器,请添加:
_gridView.ShownEditor += GridViewShownEditor;
void GridViewShownEditor(object sender, EventArgs e)
{
FontStyle fs = _gridView.ActiveEditor.Font.Style;
fs |= FontStyle.Bold;
_gridView.ActiveEditor.Font = new Font(_gridView.ActiveEditor.Font, fs);
}
指标相同:
_gridView.CustomDrawRowIndicator += GridViewCustomDrawRowIndicator;
void GridViewCustomDrawRowIndicator(object sender, EventArgs e)
{
FontStyle fs = e.Appearance.Font.Style;
fs |= FontStyle.Bold;
e.Appearance.Font = new Font(e.Appearance.Font, fs);
}
您可以在网格中设置焦点行的样式。 Grid => GridView => Appearance => FocusedRow => Font => Bold 设置为 true.