Get Hex Color Code
Posted: Sat Mar 05, 2011 7:00 pm
What This does
All this simply does it where ever the mouse hovers it will display the hex code into a textbox and the color hoved into a picture box
Things needed:
1.timer
2.Picture box
3.textbox
Instructions:
Ok add a timer from the toolbox it will be under the Components dropdown or All Windows Forms
Add this code by either double click timer1 or right clicking it and clicking view code
now just add a textbox and a picture box and your done
sorry if i didnt explain it right lol
All this simply does it where ever the mouse hovers it will display the hex code into a textbox and the color hoved into a picture box
Things needed:
1.timer
2.Picture box
3.textbox
Instructions:
Ok add a timer from the toolbox it will be under the Components dropdown or All Windows Forms
Add this code by either double click timer1 or right clicking it and clicking view code
Code: Select all
then enable the timer and make the interval anything below 100' the 1,1 or 1x1 is the pixle so its pretty much spot on feel free to edit the 1,1
Dim a As New Drawing.Bitmap(1, 1)
'importing important stuff :P ... Dim pretty much means declare but its short for Dimension/s
Dim b As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(a)
'following mouse position to pick up color
b.CopyFromScreen(New Drawing.Point(MousePosition.X, MousePosition.Y), New Drawing.Point(0, 0), a.Size)
'Drawing to picture box 1
Dim c As Drawing.Color = a.GetPixel(0, 0)
'reading what the back color is to picture box 1
PictureBox1.BackColor = c
'writes the color hex code to the textbox
TextBox1.Text = PictureBox1.BackColor.Name
now just add a textbox and a picture box and your done

sorry if i didnt explain it right lol