一、光标的指示 当光标移动到要拖动或缩放的控件上时,应显示相应的动作箭头。定义一个枚举的变量来标识对应的状态。 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 '东南到西北 |
正在阅读:编程必学:控件的拖动和缩放技术全解编程必学:控件的拖动和缩放技术全解
2004-12-09 10:11
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键