is there any way to check in a picbox if a pixel is painted over more than once and then change the color?
:confused:
Printable View
is there any way to check in a picbox if a pixel is painted over more than once and then change the color?
:confused:
Use can use GetPixel and SetPixel API's to read and draw pixels.
UsageCode:Private Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function SetPixel Lib "gdi32" Alias "SetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
Code:'Get a Pixel
lColour = GetPixel(Picture1.hDC, 5, 5)
'Draw a Pixel
SetPixel(Picture1.hDC, 5, 5)
how do i check if a pixel has been painted over more than once?
You would have to have a timer constantly monitoring it. for example sake, let's assume the Pixel should normally be coloured blue.
Code:Private Sub Timer1_Timer()
lColour = GetPixel(Picture1.hDC, 5, 5)
If lColour <> vbBlue Then '<--the colour has changed
End Sub
No one knows how to check if a pixel has been painted over more than once?
Silvertine, the code that Megatron gave you is the best you can have for this. There's no better way. Sorry.