110,537
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication25
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DataGridViewEx DGV = new DataGridViewEx();
DGV.Parent = this;
DGV.Dock = DockStyle.Fill;
DGV.Columns.Add("c1", "c1");
DGV.Columns.Add("c2", "c2");
DGV.Columns.Add("c3", "c3");
DGV.Rows.Add(100);
DGV.RowCount = 5;
Panel P = new Panel();
P.Parent = DGV;
P.BackColor = Color.Gray;
P.Size = new Size(1000 - DGV.RowHeadersWidth, 30);
P.Location = new Point(0, DGV.ClientRectangle.Bottom - SystemInformation.HorizontalScrollBarHeight- P.Height);
new TextBox().Parent = P;
}
class DataGridViewEx : DataGridView
{
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex > 10 )
{
e.Graphics.Clear(Color.Gray);
}
else
base.OnCellPainting(e);
}
}
}
}