07-09-2011, 05:48 PM
OK so i decided I would make a tutorial on how to make a program that gets the pixel of whatever the mouse pointer is on.
OK so open up Visual Basic and make a windows form application and name it (whatever you want)
Know make the form fairly small beings we will only be displaying the color of the pixel of whatever the mouse pointer is on.
Know that we have the form sized properly go to the toolbox and select timer and then go to the properties window and set enabled to true and set interval to 1.
Know double click on the timer and put this code in:
And then run the project and if done correctly whatever you pace your mouse pointer on it should get that pixel color and display it in the form.
Thank you and please comment.
OK so open up Visual Basic and make a windows form application and name it (whatever you want)
Know make the form fairly small beings we will only be displaying the color of the pixel of whatever the mouse pointer is on.
Know that we have the form sized properly go to the toolbox and select timer and then go to the properties window and set enabled to true and set interval to 1.
Know double click on the timer and put this code in:
Code:
Dim BMP As New Drawing.Bitmap(1, 1)
Dim GFX As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(BMP)
GFX.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), _
New Drawing.Point(0, 0), BMP.Size)
Dim Pixel As Drawing.Color = BMP.GetPixel(0, 0)
Me.BackColor = Pixel
Thank you and please comment.