![](/img/trans.png)
[英]How to display a RepositoryItemHyperLinkEdit control inside a DevExpress GridControl
[英]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;
您可以在網格中設置聚焦行的樣式。 網格=>網格視圖=>外觀=> FocusedRow =>字體=>粗體設置為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);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.