RT

解决方案 »

  1.   


    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)End Sub
      

  2.   

    Dim flag1 As BooleanPrivate Sub Form_Load()
        Shape1.Visible = False
            Picture1.AutoRedraw = True
    End SubPrivate Sub picture1_MouseDown(Button As Integer, _
                                   Shift As Integer, _
                                   x As Single, y As Single)
    '开始选择区域
        Shape1.Left = x
        Shape1.Top = y
        flag1 = True
    End Sub
    Private Sub picture1_MouseMove(Button As Integer, _
                                   Shift As Integer, _
                                   x As Single, y As Single)
    '在选定区域过程中随着鼠标移动产生虚线框
       If Button = 1 Then
           If flag1 = True Then
           '如果是处在正在选择区域状态
                Shape1.Width = Abs(x - Shape1.Left)
                Shape1.Height = Abs(y - Shape1.Top)
                Shape1.Visible = True
                Picture1.Refresh
            Else
                Shape1.Visible = False
            End If
        End If
    End Sub
    Private Sub picture1_MouseUp(Button As Integer, _
                                 Shift As Integer, _
                                 x As Single, y As Single)
        flag1 = False
        '结束选择区域状态
    End Sub
      

  3.   

    楼主的意思是拖动一个控件?如果是,那就是DragDrop
      

  4.   

    呀,3楼这个不是我想要的.可能我没说清楚,我是想要鼠标在windows任何程序中拖选文字的代码,就是在系统任何程序中,只要是鼠标左键按下-拖选-左键放开 就捕捉它,然后执行命令比如复制