# Re: 急!!急!! 救命!! 怎样验测任何一个Object 的每一个Pixel之颜色 ??

Posted by Cary on October 29, 1998 at 00:07:42:

In Reply to: 急!!急!! 救命!! 怎样验测任何一个Object 的每一个Pixel之颜色 ?? posted by 杀手 on October 26, 1998 at 18:14:28:

: 怎样验测任何一个Object 的每一个Pixel之颜色 ??e.g. RichTextBox, Image, DGrid etc...
下面程式希望可以 Work！
注意一下 i, j 是否对调。

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
Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long

Sub ShowPixels(Ctl as Control)
Dim DC As Long
Dim i As Integer, j As Integer
DC = GetDC(Ctl.hwnd)
For i = 0 To 20
For j = 0 To 20
Debug.Print Format(Hex$(GetPixel(DC, i, j)), "000000"); " ";
Next
Debug.Print
Next
ReleaseDC Me.RichTextBox1.hwnd, DC
End Sub

Follow Ups:

- Re: 急!!急!! 救命!! 怎样验测任何一个Object 的每一个Pixel之颜色 ?? 杀手 11:59:40 10/29/98 (0)