在winform中,自动生成编号,删除中间项,后面的编号自动改变
我用的是checkedListBoxControl控件,dev的。编号是A B C D这样的,
我想删除B 然后C变成B,D变成C。以此类推怎么实现啊。要思路就行,要代码更好啦~~!
------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace PackControl.MyDataGridView
{
public class MyDataGridView : DataGridView
{
protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
{
base.OnRowPostPaint(e);
DataGridViewSquence(this, e);
}
public void DataGridViewSquence(DataGridView datagirdview, DataGridViewRowPostPaintEventArgs e)
{
SolidBrush v_SolidBrush = new SolidBrush(datagirdview.RowHeadersDefaultCellStyle.ForeColor);
int v_LineNo = 0;
v_LineNo = e.RowIndex + 1;
string v_Line = v_LineNo.ToString();
e.Graphics.DrawString(v_Line, e.InheritedRowStyle.Font, v_SolidBrush, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 5);
}
}
}