Control/MyDataGridViewCell.cs
(完整代码) 1KBusing System;
using System.Windows.Forms;
/// <summary>
/// 单元格
/// </summary>
namespace Control
{
internal class MyDataGridViewCell : DataGridViewTextBoxCell
{
public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
{
// Set the value of the editing control to the current cell value.
base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
MyDataGridViewEditingControl ctl = (MyDataGridViewEditingControl)DataGridView.EditingControl;
if (this.Value == null || this.Value == DBNull.Value)
{
ctl.Text = "";
}
else
{
ctl.Text = this.Value.ToString();
}
}
public override Type EditType
{
get
{
// Return the type of the editing contol that CalendarCell uses.
return typeof(MyDataGridViewEditingControl);
}
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
