就想vb中编辑器中选中的效果一样,周围有小方框。表示这个控件被选中。

解决方案 »

  1.   

    设置DragIcon属性,但得先把DragMode设置为自动
      

  2.   

    建议你使用 Shape控件 使用 .Visible 属性来控制,参考下图的绿色框
      

  3.   

    如果是text文本,我要拖拽,加载界面后如何和设计界面一样,不让其获取焦点。能显示拖拽的标记呢?
      

  4.   

    添加 Image1  Label1  Picture1自己慢慢去体会吧
    Option Explicit
    Dim MouseX%, MouseY%Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single)
       Image1.Left = X - MouseX: Image1.Top = Y - MouseY
    End SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
       If Button = 1 Then
          MouseX = X: MouseY = Y
          Label1.Move Image1.Left, Image1.Top + Y - Image1.Height / 2, Image1.Width, Image1.Height
          Label1.Drag
       End If
    End SubPrivate Sub Form_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
       If State = 0 Then Source.MousePointer = 5
       If State = 1 Then Source.MousePointer = 0
    End SubPrivate Sub Picture1_DragDrop(Source As Control, X As Single, Y As Single)
       Picture1.PaintPicture Image1.Picture, X - MouseX, Y - MouseY, Image1.Width, Image1.Height
    End Sub