这样就可以实现这个功能(由于时间关系我只做了从开始向右下方的,左上方你可以根据下面的程序扩展一下)
窗口上建立一个shape1,注意将
Visible = False
Borderstyle=3-DotPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  Shape1.Visible = True
  Shape1.Top = Y: Shape1.Left = X
  Shape1.Width = 0: Shape1.Height = 0
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  On Error Resume Next
   Shape1.Width = X - Shape1.Left
   Shape1.Height = Y - Shape1.Top
End SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
 Shape1.Visible = False
End Sub

解决方案 »

  1.   

    DrawFocusRect VB声明 
    Declare Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As Long, lpRect As RECT) As Long 
    说明 
    画一个焦点矩形。这个矩形是在标志焦点的样式中通过异或运算完成的(焦点通常用一个点线表示)。如用同样的参数再次调用这个函数,就表示删除焦点矩形 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hdc Long,设备场景的句柄 
    lpRect RECT,要在逻辑坐标中描绘的矩形