主题:如何在list框中实现标题的上移和下移
wulei0301
[专家分:0] 发布于 2010-12-11 23:13:00
如何在list框中实现标题的上移和下移,以及如何通过点击一个按钮就可以直接选中最后一项标题,谢谢了
回复列表 (共2个回复)
沙发
老大徒伤悲 [专家分:29120] 发布于 2010-12-12 10:14:00
Private Function 当前选中(列表 As ListBox) As Long
For i = 0 To 列表.ListCount - 1
If 列表.Selected(i) = True Then Exit For
Next i
当前选中 = i
End Function
Private Sub Command1_Click()
List1.Selected(0) = True
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
i = 当前选中(List1) - 1
List1.Selected(i) = True
If i = 0 Then
Command2.Enabled = False
Command3.Enabled = True
End If
End Sub
Private Sub Command3_Click()
i = 当前选中(List1) + 1
List1.Selected(i) = True
If i = List1.ListCount - 1 Then
Command3.Enabled = False
Command2.Enabled = True
End If
End Sub
Private Sub Command4_Click()
List1.Selected(List1.ListCount - 1) = True
Command2.Enabled = True
Command3.Enabled = False
End Sub
Private Sub Form_Load()
Command1.Caption = "第一个"
Command2.Caption = "上一个"
板凳
老大徒伤悲 [专家分:29120] 发布于 2010-12-12 10:14:00
遗漏了三行:
Command3.Caption = "下一个"
Command4.Caption = "末一个"
End Sub
我来回复