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

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

  sender.Size = New Size(sender.Width + e.X - p1.X, sender.Height + e.Y - p1.Y)
  p1 = New Point(e.X, e.Y)

  Case EnumMousePointPosition.MouseSizeRight

  sender.Size = New Size(sender.Width + e.X - p1.X, sender.Height)

  p1 = New Point(e.X, e.Y)

  Case EnumMousePointPosition.MouseSizeTop

  sender.Location = New Point(sender.Left, sender.Top + (e.Y - p.Y))

  sender.Size = New Size(sender.Width, sender.Height - (e.Y - p.Y))

  Case EnumMousePointPosition.MouseSizeLeft

  sender.Location = New Point(sender.Left + e.X - p.X, sender.Top)

  sender.Size = New Size(sender.Width - (e.X - p.X), sender.Height)

  Case EnumMousePointPosition.MouseSizeBottomLeft

  sender.Location = New Point(sender.Left + e.X - p.X, sender.Top)

  sender.Size = New Size(sender.Width - (e.X - p.X), sender.Height + e.Y - p1.Y)
  p1 = New Point(e.X, e.Y)

  Case EnumMousePointPosition.MouseSizeTopRight

  sender.Location = New Point(sender.Left, sender.Top + (e.Y - p.Y))

  sender.Size = New Size(sender.Width + (e.X - p1.X), sender.Height - (e.Y - p.Y))
  p1 = New Point(e.X, e.Y)

  Case EnumMousePointPosition.MouseSizeTopLeft

  sender.Location = New Point(sender.Left + e.X - p.X, sender.Top + (e.Y - p.Y))

  sender.Size = New Size(sender.Width - (e.X - p.X), sender.Height - (e.Y - p.Y))

  End Select

  Else

  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

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

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

关注我们

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