PDA

View Full Version : Visual Basic.net Help-Finding the color of the pixel at a certain point


bookworm
12-02-2003, 04:27 PM
Hi. Im making a dart game in visual basic.net and i want the program to find where the dart is by seeing what color the pixel it landed on is.

In Qbasic there is a point command to do this but i cant find anything like it in the help files for vb.net.

If anyone can help , it would be appreciated

Note: this is for school but i asked the teacher and he didnt know either

Roelf
12-03-2003, 06:33 AM
is this what you are lookin for?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDrawingBitmapClassGetPixelTopic.asp

Roelf
12-03-2003, 08:27 AM
isn't it easier to divide the dartboard in concentric circles and sectors, combined with pixelcoordinates to see where the dart landed?

you have to convert the coordinates (x,y) to a distance from the centre of the board (to see if it is a bullseye, single bull, single, double or triple score) then you have to calculate the angle to see in which sector (1 to 20) the dart landed. these two values combined give the score for the dart.

Testing against the color would give some trouble because the board has only 4 colors (red, green, black(ish) and white(ish)) so that is not enough information to determine the score