PC6下载站

分类分类

控件的拖动和缩放技术教程

关注+2009-05-29作者:

控件的拖动和缩放技术教程一、光标的指示

  当光标移动到要拖动或缩放的控件上时,应显示相应的动作箭头。定义一个枚举的变量来标识对应的状态。

  Enum EnumMousePointPosition

  MouseSizeNone = 0 '无

  MouseSizeRight = 1 '拉伸右边框

  MouseSizeLeft = 2 '拉伸左边框

  MouseSizeBottom = 3 '拉伸下边框

  MouseSizeTop = 4 '拉伸上边框

  MouseSizeTopLeft = 5 '拉伸左上角

  MouseSizeTopRight = 6 '拉伸右上角

  MouseSizeBottomLeft = 7 '拉伸左下角

  MouseSizeBottomRight = 8 '拉伸右下角

  MouseDrag = 9 '鼠标拖动

  End Enum

  Dim m_MousePointPosition As EnumMousePointPosition

  在MouseMove事件中读取进入控件的光标位置,用下面函数判断光标的状态。

  m_MousePointPosition = MousePointPosition(sender.Size, e)

  按对应的状态显示光标形状

  Select Case m_MousePointPosition

  Case EnumMousePointPosition.MouseSizeNone

  Me.Cursor = Cursors.Arrow       '箭头

  Case EnumMousePointPosition.MouseDrag

  Me.Cursor = Cursors.SizeAll     '四方向

  Case EnumMousePointPosition.MouseSizeBottom

  Me.Cursor = Cursors.SizeNS      '南北

  Case EnumMousePointPosition.MouseSizeTop

  Me.Cursor = Cursors.SizeNS      '南北

  Case EnumMousePointPosition.MouseSizeLeft

  Me.Cursor = Cursors.SizeWE      '东西

  Case EnumMousePointPosition.MouseSizeRight

  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    '东南到西北

 

展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消