文件名称:VB6.0 为无标题的窗体添加鼠标效果.rar
文件大小:3KB
文件格式:RAR
更新时间:2022-07-30 11:35:29
VB源码-窗体界面
VB6.0 为无标题的窗体添加鼠标效果,Rect返回当前窗口位置,Point返回当前鼠标位置,本代码主要是使用case语句来实现,可练习一下case语句的用法哦,分享代码: Dim Point As POINTAPI Call GetWindowRect(Me.hwnd, Rect) 'Rect返回当前窗口位置 Call GetCursorPos(Point) 'Point返回当前鼠标位置 Select Case True Case Point.X < Rect.Left 5 And Point.Y < Rect.Top 5 '鼠标位于窗体左上方 Screen.MousePointer = vbSizeNWSE '45度双向鼠标 Action = "LeftUp" Case Point.X > Rect.Right - 5 And Point.Y > Rect.Bottom - 5 '鼠标位于窗体右下方 Screen.MousePointer = vbSizeNWSE Action = "RightDown" Case Point.X > Rect.Right - 5 And Point.Y < Rect.Top 5 '鼠标位于窗体右上方 Screen.MousePointer = vbSizeNESW Action = "RightUp" Case Point.X < Rect.Left 5 And Point.Y > Rect.Bottom - 5 '鼠标位于窗体的左下方 Screen.MousePointer = vbSizeNESW Action = "LeftDown" Case Point.X < Rect.Left 5 '鼠标位于窗体的左侧 Screen.MousePointer = vbSizeWE Action = "Left" Case Point.X > Rect.Right - 5 '鼠标位于窗体的右侧 Screen.MousePointer = vbSizeWE Action = "Right" Case Point.Y < Rect.Top 5 '鼠标位于窗体的上面 Screen.MousePointer = vbSizeNS '垂直双向鼠标指针 Action = "Up" Case Point.Y > Rect.Bottom - 5 '鼠标位于窗体底部 Screen.MousePointer = vbSizeNS Action = "Down" Case Else '鼠标移动 Screen.MousePointer = 0 '默认鼠标指针 Action = "Move" End Select
【文件预览】:
codesc.net
----为无标题的窗体添加鼠标效果()
--------工程1.vbw(49B)
--------MSSCCPRJ.SCC(190B)
--------Form1.frm(3KB)
--------工程1.vbp(660B)