VB getdc( ) 已经释放为什么还会出问题..请高人指点!(附原码)
VBgetdc()已经释放为什么还会出问题..出问题的时候程序走到左上角乱了~~~@_@本人新人..请高人指点指点..PrivateSubTimer1_Timer()On...
VB getdc( ) 已经释放为什么还会出问题..
出问题的时候程序走到左上角乱了~~~@_@
本人新人..请高人指点指点..
Private Sub Timer1_Timer()
On Error Resume Next
Dim rgb As Long
Dim r As String, g As String, b As String
Dim p As POINTAPI
GetCursorPos p
Dim h As Long, dc As Long
h = WindowFromPoint(p.X, p.Y)
ScreenToClient h, p
dc = GetDC(h)
Picture1.BackColor = GetPixel(dc, p.X, p.Y)
rgb = GetPixel(dc, p.X, p.Y)
call ReleaseDC (dc, h) '是不是释放错误了?call ReleaseDC (dc, h) '是不是释放错误了?
r = CStr(rgb Mod &H100)
g = CStr((rgb \ &H100) Mod &H100)
b = CStr((rgb \ &H10000) Mod &H100)
Label5 = r & " . " & g & " . " & b
Label1 = "X:" & p.X
Label2 = "Y:" & p.Y
End Sub 展开
出问题的时候程序走到左上角乱了~~~@_@
本人新人..请高人指点指点..
Private Sub Timer1_Timer()
On Error Resume Next
Dim rgb As Long
Dim r As String, g As String, b As String
Dim p As POINTAPI
GetCursorPos p
Dim h As Long, dc As Long
h = WindowFromPoint(p.X, p.Y)
ScreenToClient h, p
dc = GetDC(h)
Picture1.BackColor = GetPixel(dc, p.X, p.Y)
rgb = GetPixel(dc, p.X, p.Y)
call ReleaseDC (dc, h) '是不是释放错误了?call ReleaseDC (dc, h) '是不是释放错误了?
r = CStr(rgb Mod &H100)
g = CStr((rgb \ &H100) Mod &H100)
b = CStr((rgb \ &H10000) Mod &H100)
Label5 = r & " . " & g & " . " & b
Label1 = "X:" & p.X
Label2 = "Y:" & p.Y
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询