How do I use SetPixel and GetPixel?
Printable View
How do I use SetPixel and GetPixel?
Here's an example, getpixel is the same as point and setpixelv is the same as pset, except api's faster and you need to specify the dc
Code:'In declarations
Declare Function SetPixelV Lib "gdi32" Alias "SetPixelV" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
'In code
Dim Color&
color = getpixel(picture1.hdc,10,10)
setpixelv picture2.hdc,15,5,vbred
Aslo, you should remember to set your Form's Autoredraw property to true and remember to refresh the Form after you have drawn on the DC.