* UIDataGridView:设置数据行头部颜色

This commit is contained in:
Sunny 2021-04-29 18:12:24 +08:00
parent 92f79234d2
commit 3c50b21fb3
6 changed files with 33 additions and 2 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -70,6 +70,12 @@ namespace Sunny.UI
ColumnHeadersDefaultCellStyle.ForeColor = UIColor.White;
ColumnHeadersDefaultCellStyle.WrapMode = DataGridViewTriState.True;
//行头部颜色
RowHeadersDefaultCellStyle.BackColor = UIColor.LightBlue;
RowHeadersDefaultCellStyle.ForeColor = UIFontColor.Primary;
RowHeadersDefaultCellStyle.SelectionBackColor = UIColor.Blue;
RowHeadersDefaultCellStyle.SelectionForeColor = Color.White;
//标题行行高与OnColumnAdded事件配合
ColumnHeadersHeight = 32;
@ -88,6 +94,29 @@ namespace Sunny.UI
HorizontalScrollBar.VisibleChanged += HorizontalScrollBar_VisibleChanged;
}
/*
private bool showRowIndex;
[Description("显示行号"), Category("SunnyUI")]
[DefaultValue(false)]
public bool ShowRowIndex
{
get => showRowIndex;
set
{
showRowIndex = value;
if (value) RowHeadersVisible = true;
Invalidate();
}
}
protected override void OnRowStateChanged(int rowIndex, DataGridViewRowStateChangedEventArgs e)
{
base.OnRowStateChanged(rowIndex, e);
if (ShowRowIndex) e.Row.HeaderCell.Value = (e.Row.Index + 1).ToString();
}
*/
private void HorizontalScrollBar_VisibleChanged(object sender, EventArgs e)
{
SetScrollInfo();
@ -384,8 +413,9 @@ namespace Sunny.UI
//行头部颜色
RowHeadersDefaultCellStyle.BackColor = uiColor.PlainColor;
RowHeadersDefaultCellStyle.ForeColor = uiColor.TitleForeColor;
RowHeadersDefaultCellStyle.SelectionBackColor = uiColor.TitleColor;
RowHeadersDefaultCellStyle.ForeColor = UIFontColor.Primary;
RowHeadersDefaultCellStyle.SelectionBackColor = uiColor.RectColor;
RowHeadersDefaultCellStyle.SelectionForeColor = Color.White;
//数据行选中颜色
DefaultCellStyle.SelectionBackColor = uiColor.GridSelectedColor;

View File

@ -36,6 +36,7 @@
</PropertyGroup>
<ItemGroup>
<None Remove="Controls\UIDataGridView.cs~RF2e4ccc29.TMP" />
<None Remove="Font\ElegantIcons.ttf" />
<None Remove="Font\FontAwesome.ttf" />
<None Remove="Font\LigatureSymbols.ttf" />