正在阅读:编程必学:控件的拖动和缩放技术全解编程必学:控件的拖动和缩放技术全解

2004-12-09 10:11 出处:CSDN 作者:liubin57416 责任编辑:linjixiong

  Me.Cursor = Cursors.SizeWE      '东西

  Case EnumMousePointPosition.MouseSizeBottomLeft

  Me.Cursor = Cursors.SizeNESW    '东北到南西

  Case EnumMousePointPosition.MouseSizeBottomRight

  Me.Cursor = Cursors.SizeNWSE    '东南到西北

  Case EnumMousePointPosition.MouseSizeTopLeft

  Me.Cursor = Cursors.SizeNWSE    '东南到西北

  Case EnumMousePointPosition.MouseSizeTopRight

  Me.Cursor = Cursors.SizeNESW    '东北到南西

  End Select

  End If

  End Sub

  Private Function MousePointPosition(ByVal Size As Size, ByVal e As System.Windows.Forms.MouseEventArgs) As EnumMousePointPosition

  Const Band = 10

  If e.X >= -1 * Band And e.X <= Size.Width And e.Y >= -1 * Band And e.Y <= Size.Height Then

  If e.X < Band Then

  If e.Y < Band Then

  Return EnumMousePointPosition.MouseSizeTopLeft

  ElseIf e.Y > -1 * Band + Size.Height Then

  Return EnumMousePointPosition.MouseSizeBottomLeft

  Else

  Return EnumMousePointPosition.MouseSizeLeft

  End If

  ElseIf e.X > -1 * Band + Size.Width Then

  If e.Y < Band Then

  Return EnumMousePointPosition.MouseSizeTopRight

  ElseIf e.Y > -1 * Band + Size.Height Then

  Return EnumMousePointPosition.MouseSizeBottomRight

  Else

  Return EnumMousePointPosition.MouseSizeRight

  End If

  Else

  If e.Y < Band Then

  Return EnumMousePointPosition.MouseSizeTop

察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品