取色器,动态给出RGB的值(VB6.0源代码编写)Option Explicit

取色器,动态给出RGB的值(VB6.0源代码编写)Option Explicit Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long Dim pColor As Long Dim R As Long, G As Long, B As Long Private Sub Form_Load() Picture1.ScaleMode = 3 Picture1.Picture = LoadPicture(App.Path & "1.bmp") End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) pColor = GetPixel(Picture1.hDC, X, Y) R = pColor And &HFF G = (pColor And 65280) / 256 B = (pColor And &HFF0000) / 65536 Text1 = R Text2 = G Text3 = B End Sub
rar 文件大小:1.16MB