Richard87
02-14-2005, 01:04 AM
helo, I have som code to loop throu all the pixels in my form, but everytime I call GetPixl I get -1 in return (CLR_iNVALID), and I have no idea what I must do to make it work...
Private Sub Form_Load()
Dim iX, iY As Long
Dim tempX, tempY
Dim CustRgn As Long
Dim MainRgn As Long
Dim lNumber, lNumber2 As Long
Dim meDC As Long
Dim lColor As Long
Me.Show ' Show form
Me.BackColor = vbWhite
Me.ScaleMode = 3 'Pixel...
iX = CLng(Me.ScaleX(Me.Width)) 'form width in pixels
iY = CLng(Me.ScaleY(Me.Height)) 'form height in pixels
MainRgn = CreateRectRgn(0, 0, iX, iY)
meDC = CreateCompatibleDC(Me.hdc)
lColor = GetPixel(meDC, 5, 5)
'loop the pixels...
For tempX = 0 To iX
For tempY = 0 To iY
lColor = GetPixel(meDC, tempX, tempY)
Debug.Print lColor
Next tempY
Next tempX
End Sub
any idea?
PS. from MSDN:
The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.
what do they meen with current clipping region?
Private Sub Form_Load()
Dim iX, iY As Long
Dim tempX, tempY
Dim CustRgn As Long
Dim MainRgn As Long
Dim lNumber, lNumber2 As Long
Dim meDC As Long
Dim lColor As Long
Me.Show ' Show form
Me.BackColor = vbWhite
Me.ScaleMode = 3 'Pixel...
iX = CLng(Me.ScaleX(Me.Width)) 'form width in pixels
iY = CLng(Me.ScaleY(Me.Height)) 'form height in pixels
MainRgn = CreateRectRgn(0, 0, iX, iY)
meDC = CreateCompatibleDC(Me.hdc)
lColor = GetPixel(meDC, 5, 5)
'loop the pixels...
For tempX = 0 To iX
For tempY = 0 To iY
lColor = GetPixel(meDC, tempX, tempY)
Debug.Print lColor
Next tempY
Next tempX
End Sub
any idea?
PS. from MSDN:
The return value is the RGB value of the pixel. If the pixel is outside of the current clipping region, the return value is CLR_INVALID.
what do they meen with current clipping region?