我先解释一下我所需要设计的功能:大家都知道,如果在一个文件夹按Ctrl+A就可以实现所有的
文件全部选中,所以我想设计的和这个类似,就是鼠标左键点下去后,不松开拖动鼠标,用鼠标
拖动的方式选择想要选的东西,如果在VB里就可以相应的是在form里进行鼠标选择,比如选择form
里的label,text等,谁告诉我该怎么实现

解决方案 »

  1.   

    Dim MouseDown_X As Integer
    Dim MouseDown_Y As Integer
    Dim MouseUp_X As Integer
    Dim MouseUp_Y As IntegerPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        MouseDown_X = X
        MouseDown_Y = Y
    End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        MouseUp_X = X
        MouseUp_Y = Y
        If Label1.Left > MouseDown_X And Label1.Left < MouseUp_X Then
            If Label1.Top > MouseDown_Y And Label1.Top < MouseUp_Y Then
                Label1.ForeColor = &HFF&
            End If
        End If
    End Sub