07-28-2011, 07:48 PM
(This post was last modified: 07-28-2011, 08:00 PM by AceInfinity.)
(07-20-2011, 07:13 AM)RP Deliverance Wrote: Ya i know it is pretty basic its a tutorial when i first started to learn VB but i dont mess much with Visual Basic or Visual programming im more in Java and C/C# scripting but thanks for the feedback.
Though you can still program in C, C#, and C++ in Visual. It's all the same
- Here's my interpretation for others -
'This part defined the pixel as a 1x1 dimension
Code:
Dim BMP As New Drawing.Bitmap(1, 1)
'Getting a Bitmap value with the 1x1 dimension defined previously
Code:
Dim GFX As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(BMP)
Code:
Dim GFX As Graphics = Graphics.FromImage(BMP)
'sets the graphics point as the point at the mouse position with the size of BMP (1x1) on the screen
Code:
GFX.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), _
New Drawing.Point(0, 0), BMP.Size)
'Pixel is now a system.drawing.color which is equal to the pixel at the mouse position (0,0)
Code:
Dim Pixel As Drawing.Color = BMP.GetPixel(0, 0)
Code:
Dim Pixel As Color = BMP.GetPixel(0,0)
'Puts the color of Pixel found from the color at the mouse location to the backcolor of the form, you can define it as the backcolor of a picturebox if you wanted.
Code:
Me.BackColor = Pixel
You've overused the namespace in your code.
here's a full, more tidy version:
Code:
'Imports System.Drawing
Dim BMP As New Bitmap(1, 1)
Dim GFX As Graphics = Graphics.FromImage(BMP)
GFX.CopyFromScreen(New Point(MousePosition.X, MousePosition.Y), New Point(0, 0), BMP.Size)
Dim Pixel As Color = BMP.GetPixel(0, 0)
Me.BackColor = Pixel