DevExpress.XtraEditors.Repository.RepositoryItemCheckedComboBoxEdit 下拉框复选后可以修改选择结果、可手工录入、可选择

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/jinhoufa/article/details/83621670

 

 

 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

 

展开阅读全文

没有更多推荐了,返回首页