列表框中的蓝色(被选中状态)上下移动??
定义列表框中的条数为x.
command1为向上移动:x-1
command2为向下移动:x+1
初始值为列表框中的最后一记录。
请写出代码来,谢谢!
[解决办法]
Option ExplicitDim x As IntegerPrivate Sub Command1_Click() x = x + 1 If x > List1.ListCount Then x = List1.ListCount Exit Sub End If List1.Selected(List1.ListCount - x) = TrueEnd SubPrivate Sub Command2_Click() x = x - 1 If x < 1 Then x = 1: Exit Sub List1.Selected(List1.ListCount - x) = TrueEnd SubPrivate Sub Form_Load() Dim i As Integer For i = 0 To 10 List1.AddItem i Next List1.Selected(List1.ListCount - 1) = True x = 1End Sub