frmsetpeople2.frm

来自「vb开发的连接mysql的工作流设置程序,图形化工作流自定义工具,原先是连接到D」· FRM 代码 · 共 197 行

FRM
197
字号
VERSION 5.00
Begin VB.Form frmSetPeople2 
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   4680
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7125
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4680
   ScaleWidth      =   7125
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.ComboBox cmb 
      Height          =   300
      ItemData        =   "frmSetPeople2.frx":0000
      Left            =   300
      List            =   "frmSetPeople2.frx":000D
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   600
      Width           =   1995
   End
   Begin VB.CommandButton cmd 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   435
      Index           =   4
      Left            =   3990
      TabIndex        =   6
      Top             =   4020
      Width           =   1305
   End
   Begin VB.CommandButton cmd 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   435
      Index           =   3
      Left            =   1800
      TabIndex        =   5
      Top             =   4080
      Width           =   1305
   End
   Begin VB.CommandButton cmd 
      Caption         =   "清空"
      Height          =   435
      Index           =   2
      Left            =   2760
      TabIndex        =   4
      Top             =   2640
      Width           =   1305
   End
   Begin VB.CommandButton cmd 
      Caption         =   "删除"
      Height          =   435
      Index           =   1
      Left            =   2760
      TabIndex        =   3
      Top             =   1710
      Width           =   1305
   End
   Begin VB.ListBox lst 
      Height          =   2940
      Index           =   1
      ItemData        =   "frmSetPeople2.frx":0025
      Left            =   4650
      List            =   "frmSetPeople2.frx":0027
      MultiSelect     =   2  'Extended
      TabIndex        =   2
      Top             =   540
      Width           =   2085
   End
   Begin VB.CommandButton cmd 
      Caption         =   "添加"
      Height          =   435
      Index           =   0
      Left            =   2760
      TabIndex        =   1
      Top             =   900
      Width           =   1305
   End
   Begin VB.ListBox lst 
      Height          =   2040
      Index           =   0
      ItemData        =   "frmSetPeople2.frx":0029
      Left            =   210
      List            =   "frmSetPeople2.frx":002B
      MultiSelect     =   2  'Extended
      Sorted          =   -1  'True
      TabIndex        =   0
      Top             =   1290
      Width           =   2085
   End
End
Attribute VB_Name = "frmSetPeople2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private mIsNotFirst As Boolean
Private mSelects() As String
Public Function Display(Selects() As String) As String()
    mSelects = Selects
    Dim i As Long
    For i = 1 To UBound(mSelects)
        If mSelects(i) <> "" Then
            Me.lst(1).AddItem mSelects(i)
        End If
    Next i
    Dim a() As String
    Me.Icon = frmMain.Icon
    cmb.ListIndex = 0
    Me.Show vbModal
    Display = mSelects
End Function

Private Sub cmb_Change()
    Dim a() As String
    ReDim a(0)
    Select Case cmb.ListIndex
    Case 0
        a = MNotes.People
    Case 1
        a = MNotes.getGroups
    Case 2
        a = MNotes.Servers
    Case Else
    End Select
    Dim i As Long
    Me.lst(0).Clear
    For i = LBound(a) To UBound(a)
        If a(i) <> "" Then
            If Right$(a(i), 4) <> "[群组]" Then
                If a(i) <> "本地" Then
                    Me.lst(0).AddItem a(i)
                End If
            Else
                Me.lst(0).AddItem Left$(a(i), Len(a(i)) - 4)
            End If
        End If
    Next i
End Sub

Private Sub cmb_Click()
    cmb_Change
End Sub

Private Sub cmd_Click(Index As Integer)
    Dim i As Long
    Select Case Index
    Case 0 '添加
        For i = 0 To lst(0).ListCount - 1
            If lst(0).Selected(i) Then
                AddSelect lst(0).List(i)
            End If
        Next i
    Case 1 '删除
        With Me.lst(1)
            i = 0
            Do While i < .ListCount
                If .Selected(i) Then
                    .RemoveItem (i)
                Else
                    i = i + 1
                End If
            Loop
        End With
    Case 2 '清空
        Me.lst(1).Clear
    Case 3 '确定
        ReDim mSelects(0 To lst(1).ListCount)
        For i = 1 To lst(1).ListCount
            mSelects(i) = lst(1).List(i - 1)
        Next i
        Unload Me
    Case 4 '取消
        Unload Me
    End Select
End Sub

Private Sub AddSelect(AName As String)
    Dim i As Integer
    For i = 0 To Me.lst(1).ListCount - 1
        If AName = Me.lst(1).List(i) Then Exit Sub
    Next i
    Me.lst(1).AddItem AName
End Sub

Private Sub lst_DblClick(Index As Integer)
    If Index = 0 Then
        cmd_Click 0
    End If
End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?