📄 doubleselectbox1.ctl
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.UserControl DoubleSelectBox1
BackColor = &H00C0C0C0&
ClientHeight = 4710
ClientLeft = 0
ClientTop = 0
ClientWidth = 6840
LockControls = -1 'True
ScaleHeight = 4710
ScaleWidth = 6840
ToolboxBitmap = "DoubleSelectBox1.ctx":0000
Begin VB.ListBox lstObject
Height = 4200
Left = 3885
TabIndex = 1
Top = 285
Width = 2730
End
Begin VB.ListBox lstSource
Height = 4200
Left = 240
TabIndex = 0
Top = 285
Width = 2760
End
Begin MSComctlLib.Toolbar Toolbar
Height = 3825
Left = 3135
TabIndex = 6
Top = 480
Width = 645
_ExtentX = 1138
_ExtentY = 6747
ButtonWidth = 1138
ButtonHeight = 1349
AllowCustomize = 0 'False
Style = 1
ImageList = "ImageList1"
DisabledImageList= "ImageList1"
HotImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "向右移"
Key = "RightOne"
Object.ToolTipText = "选定项目向右移"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "全右移"
Key = "RightAll"
Object.ToolTipText = "所有项目向右移"
ImageIndex = 4
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "向左移"
Key = "LeftOne"
Object.ToolTipText = "选定项目向左移"
ImageIndex = 2
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "全左移"
Key = "LeftAll"
Object.ToolTipText = "所有项目向左移"
ImageIndex = 3
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 300
Top = 1545
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 4
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "DoubleSelectBox1.ctx":0312
Key = "rightone"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "DoubleSelectBox1.ctx":0766
Key = "leftone"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "DoubleSelectBox1.ctx":0BBA
Key = "leftall"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "DoubleSelectBox1.ctx":100E
Key = "rightall"
EndProperty
EndProperty
End
Begin VB.CommandButton cmdRightOne
BackColor = &H00FFFFC0&
Caption = "->"
Height = 450
Left = 2400
TabIndex = 2
ToolTipText = "向右移动一个"
Top = 585
Visible = 0 'False
Width = 600
End
Begin VB.CommandButton cmdRightAll
BackColor = &H00FFFFC0&
Caption = ">>"
Height = 450
Left = 2400
TabIndex = 3
ToolTipText = "将所有移到右边"
Top = 1065
Visible = 0 'False
Width = 600
End
Begin VB.CommandButton cmdLeftOne
BackColor = &H00FFFFC0&
Caption = "<-"
Height = 450
Left = 2400
TabIndex = 4
ToolTipText = "向左边移动一个"
Top = 1605
Visible = 0 'False
Width = 600
End
Begin VB.CommandButton cmdLeftAll
BackColor = &H00FFFFC0&
Caption = "<<"
Height = 450
Left = 2400
TabIndex = 5
ToolTipText = "将所有移到左边"
Top = 2085
Visible = 0 'False
Width = 600
End
Begin VB.Line Line4
BorderColor = &H00FFFFFF&
Index = 1
X1 = 90
X2 = 6780
Y1 = 4620
Y2 = 4620
End
Begin VB.Line Line3
BorderColor = &H00FFFFFF&
Index = 1
X1 = 6765
X2 = 6765
Y1 = 120
Y2 = 4635
End
Begin VB.Line Line4
BorderColor = &H00FFFFFF&
Index = 0
X1 = 90
X2 = 6750
Y1 = 135
Y2 = 135
End
Begin VB.Line Line3
BorderColor = &H00FFFFFF&
Index = 0
X1 = 90
X2 = 90
Y1 = 150
Y2 = 4590
End
Begin VB.Line Line1
Index = 1
X1 = 6750
X2 = 6750
Y1 = 150
Y2 = 4605
End
Begin VB.Line Line2
Index = 1
X1 = 75
X2 = 6765
Y1 = 4605
Y2 = 4605
End
Begin VB.Line Line2
Index = 0
X1 = 75
X2 = 6765
Y1 = 120
Y2 = 120
End
Begin VB.Line Line1
Index = 0
X1 = 75
X2 = 75
Y1 = 135
Y2 = 4620
End
End
Attribute VB_Name = "DoubleSelectBox1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private Sub cmdLeftAll_Click()
On Error Resume Next
Dim I As Integer
If lstObject.ListCount = 0 Then Exit Sub
For I = 0 To lstObject.ListCount - 1
lstSource.AddItem lstObject.List(I)
Next
Toolbar.Buttons(4).Enabled = False
Toolbar.Buttons(5).Enabled = False
Toolbar.Buttons(1).Enabled = True
Toolbar.Buttons(2).Enabled = True
lstObject.Clear
lstSource.ListIndex = lstSource.NewIndex
End Sub
Private Sub cmdLeftOne_Click()
On Error Resume Next
Dim I As Integer
If lstObject.ListCount = 0 Or lstObject.ListIndex = -1 Then
Toolbar.Buttons(4).Enabled = False
Toolbar.Buttons(5).Enabled = False
Exit Sub
End If
lstSource.AddItem lstObject.Text
Toolbar.Buttons(1).Enabled = True
Toolbar.Buttons(2).Enabled = True
I = lstObject.ListIndex
lstObject.RemoveItem I
lstSource.ListIndex = lstSource.NewIndex
If lstObject.ListCount > 0 Then
If I > lstObject.ListCount - 1 Then
lstObject.ListIndex = I - 1
Else
lstObject.ListIndex = I
End If
End If
If lstSource.ListCount > 0 Then '大于0时
Toolbar.Buttons(1).Enabled = True
Toolbar.Buttons(2).Enabled = True
Else
Toolbar.Buttons(1).Enabled = False
Toolbar.Buttons(2).Enabled = False
End If
If lstObject.ListCount > 0 Then '大于0时
Toolbar.Buttons(4).Enabled = True
Toolbar.Buttons(5).Enabled = True
Else
Toolbar.Buttons(4).Enabled = False
Toolbar.Buttons(5).Enabled = False
End If
End Sub
Private Sub cmdRightAll_Click()
On Error Resume Next
Dim I As Integer
If lstSource.ListCount = 0 Then Exit Sub
For I = 0 To lstSource.ListCount - 1
lstObject.AddItem lstSource.List(I)
Next
Toolbar.Buttons(1).Enabled = False
Toolbar.Buttons(2).Enabled = False
Toolbar.Buttons(4).Enabled = True
Toolbar.Buttons(5).Enabled = True
lstSource.Clear
lstObject.ListIndex = lstObject.NewIndex
End Sub
Private Sub cmdRightOne_Click()
On Error Resume Next
'没有选择或没有项目时退出
If lstSource.ListCount = 0 Or lstSource.ListIndex = -1 Then
Toolbar.Buttons(1).Enabled = False
Toolbar.Buttons(2).Enabled = False
Exit Sub
End If
lstObject.AddItem lstSource.Text
Dim I As Integer
I = lstSource.ListIndex
'使向左按钮有效
Toolbar.Buttons(4).Enabled = True
Toolbar.Buttons(5).Enabled = True
lstSource.RemoveItem I
lstObject.ListIndex = lstObject.NewIndex
If lstSource.ListCount > 0 Then
If I > lstSource.ListCount - 1 Then
lstSource.ListIndex = I - 1
Else
lstSource.ListIndex = I
End If
End If
If lstSource.ListCount > 0 Then '大于0时
Toolbar.Buttons(1).Enabled = True
Toolbar.Buttons(2).Enabled = True
Else
Toolbar.Buttons(1).Enabled = False
Toolbar.Buttons(2).Enabled = False
End If
If lstObject.ListCount > 0 Then '大于0时
Toolbar.Buttons(4).Enabled = True
Toolbar.Buttons(5).Enabled = True
Else
Toolbar.Buttons(4).Enabled = False
Toolbar.Buttons(5).Enabled = False
End If
End Sub
''注意!不要删除或修改下列被注释的行!
''MappingInfo=lstSource,lstSource,-1,BackColor
'Public Property Get BackColor() As OLE_COLOR
' BackColor = lstSource.BackColor
'End Property
'
'Public Property Let BackColor(ByVal New_BackColor As OLE_COLOR)
' lstSource.BackColor() = New_BackColor
' PropertyChanged "BackColor"
'End Property
'
''注意!不要删除或修改下列被注释的行!
''MappingInfo=lstObject,lstObject,-1,ForeColor
'Public Property Get ForeColor() As OLE_COLOR
' ForeColor = lstObject.ForeColor
'End Property
'
'Public Property Let ForeColor(ByVal New_ForeColor As OLE_COLOR)
' lstObject.ForeColor() = New_ForeColor
' PropertyChanged "ForeColor"
'End Property
'
''注意!不要删除或修改下列被注释的行!
''MappingInfo=lstSource,lstSource,-1,Font
'Public Property Get Font() As Font
' Set Font = lstSource.Font
'End Property
'
'Public Property Set Font(ByVal New_Font As Font)
' Set lstSource.Font = New_Font
' PropertyChanged "Font"
'End Property
'注意!不要删除或修改下列被注释的行!
'MappingInfo=lstSource,lstSource,-1,List
Public Property Get SourceList(ByVal Index As Integer) As String
Attribute SourceList.VB_Description = "返回/设置控件的列表部分中包含的项。"
SourceList = lstSource.List(Index)
End Property
Public Property Let SourceList(ByVal Index As Integer, ByVal New_SourceList As String)
lstSource.List(Index) = New_SourceList
PropertyChanged "SourceList"
End Property
'注意!不要删除或修改下列被注释的行!
'MappingInfo=lstObject,lstObject,-1,List
Public Property Get ObjectList(ByVal Index As Integer) As String
Attribute ObjectList.VB_Description = "返回/设置控件的列表部分中包含的项。"
ObjectList = lstObject.List(Index)
End Property
Public Property Let ObjectList(ByVal Index As Integer, ByVal New_ObjectList As String)
lstObject.List(Index) = New_ObjectList
PropertyChanged "ObjectList"
End Property
'注意!不要删除或修改下列被注释的行!
'MappingInfo=lstSource,lstSource,-1,ListIndex
Public Property Get SouceListIndex() As Integer
Attribute SouceListIndex.VB_Description = "返回/设置该控件中当前选定项目的索引。"
SouceListIndex = lstSource.ListIndex
End Property
Public Property Let SouceListIndex(ByVal New_SouceListIndex As Integer)
lstSource.ListIndex() = New_SouceListIndex
PropertyChanged "SouceListIndex"
End Property
'注意!不要删除或修改下列被注释的行!
'MappingInfo=lstObject,lstObject,-1,ListIndex
Public Property Get ObjectListIndex() As Integer
Attribute ObjectListIndex.VB_Description = "返回/设置该控件中当前选定项目的索引。"
ObjectListIndex = lstObject.ListIndex
End Property
Public Property Let ObjectListIndex(ByVal New_ObjectListIndex As Integer)
lstObject.ListIndex() = New_ObjectListIndex
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -