【发布时间】:2014-07-08 17:30:54
【问题描述】:
我的代码中有一个设置,其中有一个 datagridview。对于每一行,我都有一个组合框单元格,我有一个单独的组合框单元格,因为我想要为每个单元格选择不同的项目。
问题:只有双击箭头时单元格才会下拉。如何更改单元格格式,或者可能是单元格单击事件,以便单元格响应一次单击?
这是我的单元格创建代码。坦率地说,我没有启动任何其他代码,因为我不知道要触摸或调用什么事件。有我可以编辑的属性吗?
代码:
'add items to combobox list
Dim comboCell As New DataGridViewComboBoxCell
comboCell.FlatStyle = FlatStyle.Flat
Dim resolutionList As New List(Of cmbStruct)
Dim currentResIndex As Integer = 0
'create list of resolutions
For j As Integer = 0 To resolutions.Length - 1
Dim resClass As New cmbStruct
resClass.Name = resolutions(j)
resClass.ID = resolutions(j)
resolutionList.Add(resClass)
comboCell.Items.Add(resolutions(j))
Next
'set combocell values
comboCell.DisplayMember = "Name"
comboCell.ValueMember = "ID"
'set the default value to the current resolution index
Try
comboCell.Value = resolutions(currentResIndex)
Catch ex As Exception
End Try
comboCell.ValueType = GetType(cmbStruct)
comboCell.DataSource = resolutionList
editCameraTable("Resolution", i) = comboCell
Next
【问题讨论】:
标签: vb.net datagridview datagridviewcombobox