OnForm load, insert this code:
Private Sub Form1_Load() Handles MyBase.Load
Me.Size = New Size(200, 100)
Button1.Dock = DockStyle.Fill
Timer1.Interval = 50
Me.TopMost = True
MsgBox("Press Start Capture to Start." & _
"and then clik on your screen")
End Sub
On Button Click:
Private Sub Button1_Click() Handles Button1.Click
Timer1.Start()
Me.WindowState = FormWindowState.Minimized
End SubTimer1.Start()
Me.WindowState = FormWindowState.Minimized
when button pressed, program will start to waiting with timer when mouse clicked.
and this the code for timer tick event:
Private Sub Timer1_Tick() Handles Timer1.Tick
If Control.MouseButtons = Windows.Forms.MouseButtons.Left Then
Timer1.Stop()
Dim c As Color
Dim bmp As New Bitmap(1, 1)
Dim g As Graphics = Graphics.FromImage(bmp)
g.CopyFromScreen(Control.MousePosition, New Point(0, 0), New Size(1, 1))
c = bmp.GetPixel(0, 0)
g.Dispose()
bmp.Dispose()
Me.WindowState = FormWindowState.Normal
Me.TopMost = True
Clipboard.SetText(ColorTranslator.ToHtml(c))
MsgBox("Color captured to clipboard." & vbNewLine & "Just paste it.")
End If
End Sub
when timer found condition where mouse state is clicked, then timer will stop and get the color at mouse clicked, the result is saving in the clipboard, you just paste it. this I make because i need to capture my blog color and then applying color to my new widget. :-)
1 comments:
admin - plz share your page address of facebook. I want to up to date with your post via facebook.
Post a Comment