datagrid1.CurrentCell
datagrid1.CurrentRowIndex
datagrid1.CurrentRowIndex
解决方案 »
- Gridview中如何去除HTML
- 急急急急急急急急急急急急!ListView要绑定Access数据库并显示里面的东西
- reflector 反编译的问题。
- 请问,如何将局域网上的共享文件复制到本地??急。。
- 为什么主页中的iframe所连接的页面报$未定义,OBJECT未定义!!!
- 在win7中报异常,但是在XP和win2003中确是好好的?
- DataTable某列为数字,排序时为什么有时候按字符串排序,有时候又按数字排序?随机/
- “未能将临时文件复制到输出目录中”的错误是为什么?
- 封装成dll的问题 版本信息呢?
- Asp.net中,想把图片bitmap存入到数据库,怎么处理呢?
- 有没有象mfc中的command management 一样的办法,实现toolbar和menu事件对应起来?
- C#中如何实现类似Word的拼写功能(英语)?
可以是一行選擇
重写DataGridTextBoxColumn, // MyTextBoxColumn
protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
// Do nothing.
}
然后在datagrid中加入tablestyle, tablestyle中使用你自己写的MyTextBoxColumn
尝试以下代码
在MyTextBoxColumn中
protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
{
base.Edit(source,rowNum, bounds, readOnly, instantText , cellIsVisible); DataGridCell cell = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();
this.TextBox.Location = cell.Location;
this.TextBox.Size = new Size( cell.Width, cell.Height );
}
System.Drawing.Rectangle cell = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();
不是:
DataGridCell cell = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();