在DataGridView中添加自定义DataGridViewColumn时出现问题 [英] Problem in adding Custom DataGridViewColumn in DataGridView

查看:660
本文介绍了在DataGridView中添加自定义DataGridViewColumn时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发桌面应用程序.在这里我想在DataGridView中使用dataTimePicker在DataGridView单元格中选择一个日期.我已经创建了一个新的DataGridViewColumn,DataGridViewCell和从DateTimePicker继承并实现IDataGridViewEditingControl的新控件,如如何:Windows窗体DataGridView单元中的主机控件"中所述,实现了IDataGridViewEditingControl.并在我的项目中包含了包含上述类的库.

但是,当我在设计器中打开datagridview列编辑页面时,在ColumnType列表中看不到新定义的列类型.


预先感谢您提供的任何帮助.

Hi,

I am working on a desktop application. Here i want to use dataTimePicker in DataGridView to select a date in DataGridView cell. I have created a new DataGridViewColumn, DataGridViewCell and new control inherited from DateTimePicker and implementing IDataGridViewEditingControl as given in microsoft atricle of "How to: Host Controls in Windows Forms DataGridView Cells." and included the library containing above classes in my project.

But when i open datagridview columns editing page in designer i can not see the new defined column type in the ColumnType List.


Thanks in advance for any kind of help.

推荐答案

请查看MSDN帮助页面上的System.Windows.Forms.DataGridViewCell. Value的类型是什么?是的,它是System.Object.这意味着:您几乎可以托管任何东西.

请参阅:

http://msdn.microsoft.com/en-us/library/system. windows.forms.datagridviewcell.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.value.aspx [ ^ ].

这是在DataGridView单元格中托管控件的简短手册:
http://msdn.microsoft.com/en-us/library/7tas5c80.aspx [ ^ ].

—SA
Look at the MSDN help page for the System.Windows.Forms.DataGridViewCell. What is the type of its Value? Right, it''s System.Object. It means: you can host nearly anything.

Please see:

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.value.aspx[^].

This is a short manual on hosting controls in the cells of DataGridView:
http://msdn.microsoft.com/en-us/library/7tas5c80.aspx[^].

—SA


这篇关于在DataGridView中添加自定义DataGridViewColumn时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆