Click to See Complete Forum and Search --> : getting and changing pixel colors
Silvertine
Nov 26th, 2000, 01:59 PM
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.
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
Usage
'Get a Pixel
lColour = GetPixel(Picture1.hDC, 5, 5)
'Draw a Pixel
SetPixel(Picture1.hDC, 5, 5)
Silvertine
Nov 26th, 2000, 04:18 PM
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.
Private Sub Timer1_Timer()
lColour = GetPixel(Picture1.hDC, 5, 5)
If lColour <> vbBlue Then '<--the colour has changed
End Sub
Silvertine
Nov 29th, 2000, 09:17 PM
No one knows how to check if a pixel has been painted over more than once?
oetje
Dec 1st, 2000, 10:13 AM
Silvertine, the code that Megatron gave you is the best you can have for this. There's no better way. Sorry.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.