如何在DATAGRID中的单元格集成时间格式 RT,比如在焦点到这一单元格时,已经有预定义的时间如00:00:00我只要修改其中的数字就可以了也就是说不用自己输入冒号客户要求的郁闷 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把该单元格使用自定义输入控件实现,可以切入MaskedTextBox,如何在DataGrid中使用自定义控件可以参考,http://www.codeproject.com/cs/miscctrl/cprogressdatagrid.asp 也可以参考切入DateTimePicker的例子,private void Student_Styles(){//#1,这是一个绑定日期获取器的例子,共三步,请看#1,#2,#3 style.GridColumnStyles.AddRange(new DataGridColumnStyle[]{id,room_id,real_name,sex,card,tel,degree,post,address,birth}); dgMain.TableStyles.Add(style); //订阅单元格获得焦点时发生的事件 dgBox=(DataGridTextBoxColumn)dgMain.TableStyles[0].GridColumnStyles[9];//哪一列出现 dgBox.TextBox.GotFocus+= new EventHandler(this.dgBox_GotFocus); //}//#2private void dgBox_GotFocus(object o, EventArgs e){ DateTimePicker dtp = new DateTimePicker(); dtp.Dock = DockStyle.Fill; dtp.Cursor = Cursors.Arrow; dtp.ValueChanged+=new EventHandler(this.dtg_ValueChanged);//日期获取器变化 dgBox.TextBox.Controls.Add(dtp); dtp.BringToFront(); }//#3private void dtg_ValueChanged(object sender, System.EventArgs e){ int lineNum=dgMain.CurrentCell.RowNumber;//或dgMain.CurrentRowIndex dgMain[lineNum,9]=((DateTimePicker)(sender)).Value.ToShortDateString(); } 我在尝试着嵌入DateTimePicker 我切入DATATIMEPICKER 还是无法显示 底层HTTP协议通信问题 急求解答(右键问题) C#写入数据到mysql数据库,这段代码哪里有问题?请教各位! 在C#中比较两个数组 已知一点的经纬度和该点与另一点的距离以及两点之间的角度,如何计算出另一点的坐标 卸载程序怎么制作 Windows2003下如何设置IIS才可以使用WebClient上传? 用C#做一个登陆器,然后创建SESSION ,如何与ASP.net网站公共? 留言簿设计问题 关于应用程序域,程序集,插件技术的困惑 本人的超难解决问题之一 Server.Transfer和Session发生问题
http://www.codeproject.com/cs/miscctrl/cprogressdatagrid.asp
private void Student_Styles()
{
//#1,这是一个绑定日期获取器的例子,共三步,请看#1,#2,#3
style.GridColumnStyles.AddRange(new DataGridColumnStyle[]{id,room_id,real_name,sex,card,tel,degree,post,address,birth});
dgMain.TableStyles.Add(style);
//订阅单元格获得焦点时发生的事件
dgBox=(DataGridTextBoxColumn)dgMain.TableStyles[0].GridColumnStyles[9];//哪一列出现
dgBox.TextBox.GotFocus+= new EventHandler(this.dgBox_GotFocus);
//}
//#2
private void dgBox_GotFocus(object o, EventArgs e)
{
DateTimePicker dtp = new DateTimePicker();
dtp.Dock = DockStyle.Fill;
dtp.Cursor = Cursors.Arrow;
dtp.ValueChanged+=new EventHandler(this.dtg_ValueChanged);//日期获取器变化
dgBox.TextBox.Controls.Add(dtp);
dtp.BringToFront();
}
//#3
private void dtg_ValueChanged(object sender, System.EventArgs e)
{
int lineNum=dgMain.CurrentCell.RowNumber;//或dgMain.CurrentRowIndex
dgMain[lineNum,9]=((DateTimePicker)(sender)).Value.ToShortDateString();
}