问题1:调用ListBox1_MeasureItem(ByVal sender As Object, ByVal e As System.Windows.Forms.MeasureItemEventArgs)时,括号里的参数怎么样传递? 尤其是后一个差数 问题2:在ListBox1_SelectedIndexChanged()里怎么样得到当前选定项的坐标位置?
回答问题2:
先循环一遍,判断选定项被选中,k为被选中的坐标位置
dim i,k,j as Integer
For i = 0 To ListBox1.Items.Count - 1
If ListBox1.GetSelected(i) = True Then Exit For
k= i+1
Next
这是在ListBox中选中一个,要是选中两个,则上面的是得到第一个被选中的项的坐标位置,下面一段是得到第二个被选中的项的坐标位置。
For i = 0 To ListBox1.Items.Count - 1
If ListBox1.GetSelected(i) = True Then
j= i
End If
Next