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

0
1671

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:
    [vbnet]Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Dim a As New Drawing.Bitmap(1, 1)
    Dim b As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(a)
    b.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), New Drawing.Point(0, 0), a.Size)
    Dim c As Drawing.Color = a.GetPixel(0, 0)
    PictureBox1.BackColor = c
    TextBox1.Text = PictureBox1.BackColor.Name
    End Sub[/vbnet]
  • 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:

 

 

 

 

 

Looking for more source code? Type your keyword here here!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.