Files
KJD/TEMUKJD/UserComponent/DataGridViewXEx.cs
T

28 lines
1001 B
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevComponents.DotNetBar.Controls;
namespace TemuKJD.UserComponent
{
public class DataGridViewXEx : DataGridViewX
{
public DataGridViewXEx()
{
BackgroundColor = Color.White;
AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(249, 249, 249);
RowPostPaint += DataGridViewXEx_RowPostPaint;
}
private void DataGridViewXEx_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), RowHeadersDefaultCellStyle.Font, rectangle, Color.DarkGray, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
}