控件的拖动和缩放技术全解,控件的拖动和缩放技术全解
【 tulaoshi.com - ASP.NET 】
一、光标的指示当光标移动到要拖动或缩放的控件上时,应显示相应的动作箭头。定义一个枚举的变量来标识对应的状态。
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事件中读取进入控件的光标位置,用下面函数判断光标的状态。
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com)m_MousePointPosition = MousePointPosition(sender.Size, e)
按对应的状态显示光标形状
Select Case m_MousePointPosition
(本文来源于图老师网站,更多请访问http://www.tulaoshi.com)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 '东南到西北
本新闻共6页,当前在第1页 1 2 3 4 5 6
来源:http://www.tulaoshi.com/n/20160129/1490925.html
看过《控件的拖动和缩放技术全解》的人还看了以下文章 更多>>