Wierd Bitmap Error

rifter1818

Well-known member
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
An unhandled exception of type System.ArgumentException occurred in system.drawing.dll

Additional information: Invalid parameter used.

The program [4200] Windows Application.exe has exited with code 0 (0x0).
....
Funny thing is this happens when i ask for any info from the bitmap. i can clone it no problem, but if i ask for size (or in the case of this error getpixel(x,y) with x and y well within the range of bitmaps dimensions....
Code:
                Windows.Forms.SendKeys.SendWait("+{PRTSC}")
                tbit = New Bitmap(1024, 768)
                tbit = Windows.Forms.Clipboard.GetDataObject.GetData(GetType(Bitmap))
                If tbit.GetPixel(PlayArea.X + 348, PlayArea.Y + 61).ToArgb <> Color.Black.ToArgb Then
                    tbit.Dispose()
                    Wait(500)
                Else
The line returning the error is the if tbit.getpixel...... one...
PlayArea is a point with small x,y values.
Any ideas what im doing wrong?
 
You really ought to compile with Debug so you dont get those exceptions and stuff. Anyway the error is that your trying to read a pixel outside the area of the picture. Make sure you dont loop too far.

Anyone know of a .NET control to read bitmaps with DMA? The one on XVBtalk doesnt convert properly from vb6, and I need to speed up the process for my programs.
 
Back
Top