How can I make the display text in devexpress gridcontrol's indicator bold ?
Changing the indicator cell style here also changes the background color. But I just want to make the indicator cell display text bold, with default background color.
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;
You can set style of focused row in your grid. Grid => GridView => Appearance => FocusedRow => Font => Bold set to true.
We use this code:
_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);
}
if you have editors, add this:
_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);
}
And for indicator the same:
_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);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.