这段代码是什么意思? [英] What is the meaning of this code?

查看:125
本文介绍了这段代码是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub lvinventory_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lvInventory.MouseDoubleClick


        CurrentItem = lvInventory.GetItemAt(e.X, e.Y)
        If CurrentItem Is Nothing Then Exit Sub
        CurrentSB = CurrentItem.GetSubItemAt(e.X, e.Y)

        Dim iSubIndex As Integer = CurrentItem.SubItems.IndexOf(CurrentSB)

        Select Case iSubIndex
            Case 12
            Case Else
                Exit Sub
        End Select


        If iSubIndex = 0 Then
            CurrentItem.BeginEdit()
            Exit Sub
        End If



        Dim lLeft = CurrentSB.Bounds.Left + 2
        Dim lWidth As Integer = CurrentSB.Bounds.Width
        With TextBox1
            .SetBounds(lLeft + lvInventory.Left, CurrentSB.Bounds.Top + _
                       lvInventory.Top, lWidth, CurrentSB.Bounds.Height)
            .Text = CurrentSB.Text
            .Show()
            .Focus()


        End With
    End Sub

推荐答案

前4行获取单元格的索引在listview中单击了。然而,除了单元格12(Case Else)之外,Select Case语句几乎退出sub。



那么如果索引是0,那它永远不会是谢谢对于其他情况,它将开始就地编辑。



之后它会尝试在你正在编辑的单元格顶部显示一个文本框。
The first 4 lines get the index of the cell that was clicked in the listview. However the Select Case statement pretty much exits the sub for any case except cell 12 (the Case Else).

Then if the index is 0, which it never is thanks to the case else, it will begin in place editing.

After that it tries to show a textbox on top of the cell that you are editing.


这一切都是得到的在ListView中单击的项目并修改TextBox的边界。如果你想要更多,那么你必须要求编写它的人或者在调试器中逐行浏览代码并观察变量和屏幕上发生的事情。
All this does is get the item that was clicked in a ListView and modify the bounds of a TextBox. If you want more than that, you'll have to either ask the guy who wrote it or step through the code line-by-line in the debugger and watch what happens in the variables and on screen.


这篇关于这段代码是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆