DropDownButton问题(vb.net)
本帖最后由 forevermini 于 2011-07-21 18:47:31 编辑 DevExpress中有个DropDownButton控件,不知道怎么用,怎么向下拉中加入项目?注意不是用在工具栏的那种DropDownButton哦,而是可以放在窗体里的任何地方都可以,点击最右边向下箭头的事件是什么事件?希望各位指点,尽量详细点,先谢谢各位了!!!
[解决办法]
我没有找到DropDownButton控件,但下面的也实现了拉上拉下的功能,做两个Button。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndices.Contains(0) Then
Exit Sub
End If
Dim k As Integer
For k = ListBox1.SelectedIndices.Item(0) - 1 To ListBox1.SelectedIndices.Item(ListBox1.SelectedIndices.Count - 1)
If ListBox1.SelectedIndices.Contains(k + 1) Then
Change(k, k + 1)
End If
Next
End Sub
Private Sub Change(ByVal a As Integer, ByVal b As Integer)
Dim temp
temp = ListBox1.Items(a)
ListBox1.Items(a) = ListBox1.Items(b)
ListBox1.Items(b) = temp
ListBox1.SelectedIndices.Remove(b)
ListBox1.SelectedIndices.Add(a)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If ListBox1.SelectedIndices.Contains(ListBox1.Items.Count - 1) Then
Exit Sub
End If
Dim k As Integer
For k = ListBox1.SelectedIndices.Item(ListBox1.SelectedIndices.Count - 1) + 1 To ListBox1.SelectedIndices.Item(0) Step -1
If ListBox1.SelectedIndices.Contains(k - 1) Then
Change(k, k - 1)
End If
Next
End Sub