不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
VB6.0实现放大镜效果
编辑:dnawo 日期:2010-10-13
在界面上添加一个PictureBox控件(Picture1)和一个Timer控件(Timer1),然后添加如下代码:
复制内容到剪贴板
程序代码

'Win32 Api
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Const HWND_TOPMOST = -1 '窗口置顶
Private Const HWND_NOTOPMOST = -2 '正常窗口
Private Const SWP_NOSIZE = &H1 '窗口保持原大小
Private Const SWP_NOMOVE = &H2 '窗口保持原位置
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Load()
'窗口置顶
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE
'定时器设置
Timer1.Enabled = True
Timer1.Interval = 50
'设置Picture大小,长宽单位:Twip,1 Pixel=15 Twip
Picture1.Width = 1500
Picture1.Height = 1500
Picture1.BackColor = &H0
End Sub
'定时捕捉
Private Sub Timer1_Timer()
Dim result As Long
Dim point As POINTAPI
result = GetCursorPos(point)
If result <> 0 Then
If point.x < 5 or point.x > Screen.Width - 5 or point.y < 5 or point.y > Screen.Height - 5 Then
Picture1.Cls '只在需要时清除,以免PictureBox一直闪动
End If
'放大100倍,坐标单位:Pixel
StretchBlt Picture1.hdc, 0, 0, 100, 100, GetDC(0), point.x - 5, point.y - 5, 10, 10, &HCC0020
End If
End Sub
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Const HWND_TOPMOST = -1 '窗口置顶
Private Const HWND_NOTOPMOST = -2 '正常窗口
Private Const SWP_NOSIZE = &H1 '窗口保持原大小
Private Const SWP_NOMOVE = &H2 '窗口保持原位置
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Form_Load()
'窗口置顶
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE
'定时器设置
Timer1.Enabled = True
Timer1.Interval = 50
'设置Picture大小,长宽单位:Twip,1 Pixel=15 Twip
Picture1.Width = 1500
Picture1.Height = 1500
Picture1.BackColor = &H0
End Sub
'定时捕捉
Private Sub Timer1_Timer()
Dim result As Long
Dim point As POINTAPI
result = GetCursorPos(point)
If result <> 0 Then
If point.x < 5 or point.x > Screen.Width - 5 or point.y < 5 or point.y > Screen.Height - 5 Then
Picture1.Cls '只在需要时清除,以免PictureBox一直闪动
End If
'放大100倍,坐标单位:Pixel
StretchBlt Picture1.hdc, 0, 0, 100, 100, GetDC(0), point.x - 5, point.y - 5, 10, 10, &HCC0020
End If
End Sub
评论: 0 | 引用: 0 | 查看次数: 5323
发表评论
请登录后再发表评论!