如何取得当前鼠标点的色彩值,多谢

解决方案 »

  1.   

    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 Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    Private Sub Timer1_Timer()
    Dim a As Long
    Dim pp As POINTAPI
    Dim dd As Long
    a = GetDC(0)
    GetCursorPos pp
    dd = GetPixel(a, pp.x, pp.y)
    Text1.Text = Abs(dd And &HFF)
    Text2.Text = Abs(dd And 65280) / 256
    Text3.Text = Abs(dd And &HFF0000) / 65536
    ReleaseDC Me.hwnd, a
    End Sub
      

  2.   

    debug.print point(x,y)就这个,哎忘了就记不起来啦