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:
- 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
- Click F5 to run the program and try to move around your mouse to see the results.
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:
- How to Create an Animated Text in VB.Net
- How to Add Watermark to a Picture using VB.Net
- 14-HTML Background Color [bgcolor]