Dim repositoryItemCheckedComboBox As DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit
repositoryItemCheckedComboBox = New DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit()
With repositoryItemCheckedComboBox
.Name = "GVcolEditorCheckedComboBox"
.AutoHeight = False
.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder
End With
GridControl.RepositoryItems.Add(repositoryItemCheckedComboBox)
'鼠标按下事件
Private Sub GridView_MainMaterial_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GridView_MainMaterial.MouseDown
With Me.GridView_MainMaterial
If .RowCount = 0 Then Exit Sub
If .FocusedRowHandle < 0 Then Exit Sub
'部位下拉框可多选
If .FocusedColumn.FieldName.ToUpper = "Part".ToUpper Then
'.Columns("Part".ToUpper).ColumnEdit = GridControl_MainMaterial.RepositoryItems("GVcolEditorCheckedComboBox")
'PartName CheckedComboBox
If TryCast(.Columns("Part".ToUpper).ColumnEdit, DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit) IsNot Nothing Then
'生成列之后,也可在这里设置相关列格式 AddHandler repositoryItemDateMonthDayEdit.ParseEditValue, AddressOf DateTimeToString
Dim repositoryItemCheckedComboBoxEdit As DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit
repositoryItemCheckedComboBoxEdit = TryCast(.Columns("Part".ToUpper).ColumnEdit, DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit)
'设置文本框是否可编辑
repositoryItemCheckedComboBoxEdit.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard
Dim LdtTypeName As New DataTable
objsql.PstrSql = "SELECT distinct PartName FROM T_RD_BD_PartName "
objsql.RunSqlwithString(common.objSql.ActionListWithString.ActSelectReturnDTAll)
LdtTypeName.Clear()
LdtTypeName = objsql.PReturnDT
With repositoryItemCheckedComboBoxEdit
.ValueMember = "PartName"
.DisplayMember = "PartName"
.DataSource = LdtTypeName
.PopupSizeable = True
.PopupFormSize = New System.Drawing.Size(100, 300)
.SelectAllItemVisible = True '控制 Select All
.SelectAllItemCaption = "选择全部部位"
End With
End If
End If
End With
End Sub