VB判断某点颜色的代码?? 20
2个回答
展开全部
Option Explicit
Private Sub Form_Load()
Me.Show
DoEvents
Me.BackColor = &HFFFFFF
If Me.Point(180, 90) = &HFFFFFF Then
MsgBox "Yes"
End If
End Sub
Private Sub Form_Load()
Me.Show
DoEvents
Me.BackColor = &HFFFFFF
If Me.Point(180, 90) = &HFFFFFF Then
MsgBox "Yes"
End If
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Command1_Click()
h = GetDC(0) '取得整个屏幕的DC
Colr = GetPixel(h, 180, 90) '取颜色
ReleaseDC 0, hdc '释放hDC
If Colr = &Hffffff Then
MsgBox "相同"
Else
MsgBox "不同"
End If
End Sub
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Sub Command1_Click()
h = GetDC(0) '取得整个屏幕的DC
Colr = GetPixel(h, 180, 90) '取颜色
ReleaseDC 0, hdc '释放hDC
If Colr = &Hffffff Then
MsgBox "相同"
Else
MsgBox "不同"
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询