vb image 里面的图片某点的像素颜色如何获取?
2个回答
展开全部
Dim str As String
Private Sub Image1_Click()
MsgBox str
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
str = "你选取的所在点的颜色值是" & Hex(Point(X, Y))
End Sub
Private Sub Image1_Click()
MsgBox str
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
str = "你选取的所在点的颜色值是" & Hex(Point(X, Y))
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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 GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim p As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos p
l = GetDC(0)
Me.Caption = GetPixel(l, p.x, p.y)
Label1.BackColor = Me.Caption
End Sub
Private Declare Function GetDC Lib "user32" (ByVal hwnd 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 Type POINTAPI
x As Long
y As Long
End Type
Dim p As POINTAPI
Private Sub Timer1_Timer()
GetCursorPos p
l = GetDC(0)
Me.Caption = GetPixel(l, p.x, p.y)
Label1.BackColor = Me.Caption
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询