首页上一页 1 下一页尾页 1 条记录 1/1页
能帮我详细解释下这段代码红色部分吗?
发表在VB答疑区
2010-08-27
是否精华
是
否
版块置顶:
是
否
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Const Srccopy = &HCC0020
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) 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
Dim pos As POINTAPI
Private Sub Form_Load()
Dim usew As Double
Dim useh As Double
usew = Form1.Width / [font color=#FF0000]Screen.TwipsPerPixelX[/font]
useh = Form1.Height / [font color=#FF0000]Screen.TwipsPerPixelY[/font]
End Sub
[font color=#FF0000]Private Sub start()[/font]
Dim sx As Integer
Dim sy As Integer
[font color=#FF0000]GetCursorPos pos
sx = IIf(pos.x < 100 Or pos.x > 1000, IIf(pos.x < 100, 0, 1000), pos.x - 100)
sy = IIf(pos.y < 100 Or pos.y > 800, IIf(pos.y < 100, 0, 800), pos.y - 100)
Caption = "坐标" & sx & "," & sy & "放大镜"
StretchBlt hdc, 0, 0, 200, 200, GetDC(0), sx, sy, 100, 100, Srccopy[/font]
End Sub
Private Sub Timer1_Timer()
start
End Sub
Private Sub Form_DblClick()
Unload Me
End Sub
Private Type POINTAPI
x As Long
y As Long
End Type
Const Srccopy = &HCC0020
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) 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
Dim pos As POINTAPI
Private Sub Form_Load()
Dim usew As Double
Dim useh As Double
usew = Form1.Width / [font color=#FF0000]Screen.TwipsPerPixelX[/font]
useh = Form1.Height / [font color=#FF0000]Screen.TwipsPerPixelY[/font]
End Sub
[font color=#FF0000]Private Sub start()[/font]
Dim sx As Integer
Dim sy As Integer
[font color=#FF0000]GetCursorPos pos
sx = IIf(pos.x < 100 Or pos.x > 1000, IIf(pos.x < 100, 0, 1000), pos.x - 100)
sy = IIf(pos.y < 100 Or pos.y > 800, IIf(pos.y < 100, 0, 800), pos.y - 100)
Caption = "坐标" & sx & "," & sy & "放大镜"
StretchBlt hdc, 0, 0, 200, 200, GetDC(0), sx, sy, 100, 100, Srccopy[/font]
End Sub
Private Sub Timer1_Timer()
start
End Sub
Private Sub Form_DblClick()
Unload Me
End Sub