How to Get Pixel Color and Name from the Screen Using VB.Net

0
78

This tutorial is all about How to Get Pixel Color and Name from the Screen Using VB.Net. With this tutorial you can get Get Pixel Color and Name from the Screen Using VB.Net easily. So let’s get started:

  • First is open the Visual Basic, Select File on the menu, then click New and create a new project.

  • Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK

 

  • Then design your form like this just like what I’ve shown you below.
    Add a Picturebox, Textbox, and a Timer from the toolbox.
  • After that set the Time interval of Timer to 1 and set the Enable property of it to True in the Properties.
  • Double Click the Timer and add this following codes:
    1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2. Dim a As New Drawing.Bitmap(1, 1)
    3. Dim b As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(a)
    4. b.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), New Drawing.Point(0, 0), a.Size)
    5. Dim c As Drawing.Color = a.GetPixel(0, 0)
    6. PictureBox1.BackColor = c
    7. TextBox1.Text = PictureBox1.BackColor.Name
    8. End Sub
  • Click F5 to run the program and try to move around your mouse to see the results.
    Output:

 

If you have any comments or suggestion about on How to Get Pixel Color and Name from the Screen Using VB.Net, Please Feel Free to contact our webpage.

Download How to Get Pixel Color and Name from the Screen Using VB.Net Code Here

 

 

Other articles you might like to read:

 

 

 

 

 

Facebook Comments
(Visited 86 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here