在DataGridView中添加自定义DataGridViewColumn时出现问题 [英] Problem in adding Custom DataGridViewColumn in DataGridView
问题描述
我正在开发桌面应用程序.在这里我想在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 theSystem.Windows.Forms.DataGridViewCell
. What is the type of itsValue
? Right, it''sSystem.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 ofDataGridView
:
http://msdn.microsoft.com/en-us/library/7tas5c80.aspx[^].
—SA
这篇关于在DataGridView中添加自定义DataGridViewColumn时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!