Hello :)
I would make this:
But i don't have any idea about how can i make this.Code:If (Coords) = FFF0F0F0 Then
.......
Else
.....
End If
Thanks and sorry my enlgish errors.
Printable View
Hello :)
I would make this:
But i don't have any idea about how can i make this.Code:If (Coords) = FFF0F0F0 Then
.......
Else
.....
End If
Thanks and sorry my enlgish errors.
Create a bitmap that represents your screen, then use Bitmap.GetPixel to get the color of a specific coordinate. To check if the color matches your html color code, use ColorTranslator.FromHtml.
You must commit whatever you're scanning to a Bitmap first (if it's a form background image or similar then you already have that step done).
If bmp.GetPixel(x, y) = Color.FromArgb(&HFF, &HF0, &HF0, &HF0) Then
I have a bad - medium level in VB and i don't know how to manage Libs. I need some libs?
The color is in a Windows (Chrome).
How can i scan it?
Thanks a lot :)
I think that i didn't say good.
I select a coords (X=100 Y=900 for example) and If this point is color #FF43523 Then...
Bitmap.GetPixel scan all scren, or a image.
It's the same for my question?
Did you read the documentation on Bitmap.GetPixel?That's why in post #2 I suggest to create a bitmap that represents your form, then use Bitmap.GetPixel to get a color of the specified pixel.Quote:
Gets the color of the specified pixel in this Bitmap.
Sorry if i'm saying nonsenses, but i never manage this topic.
With Bitmap.GetPixel I need say one file:
I need that the bold text will be my screen. How can i make this?Quote:
Dim myBitmap As New Bitmap("grapes.jpg")
Dim pixelColor As Color = myBitmap.GetPixel(50, 50)
I have this code:
But how can I tell VB the coords that I want get pixel?Quote:
Dim myBitmap As New Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)
Dim something As Color = myBitmap.GetPixel(50, 50)
Dim something1 As Color = TextBox3.BackColor
If something = TextBox3.BackColor Then
TextBox3.Text = ":-D"
Else
TextBox3.Text = "D-:"
End If
Dim something As Color = myBitmap.GetPixel(50, 50)
There's the co-ordinates x,y. You change them as you wish.
I...think he wants a screenshot to be the bitmap?
I want that get pixel of the actual screen; in a started timer.
Don't detect a pixel with ..GetPixel(1014, 615) and is the same color.
I only need to do that in coord (1000, 500) if is #FF09532 do something, and else, another thing.
For example.Code:If coord (1000, 500) = #FF09532 Then
Textbox1.text = "Hello"
Else
Textbox1.text = "Bye"
End If
Is one windows of Google Chrome where i want scan.
The scan is enabled by other conditional.
One example.Code:If textbox2.text = "0" Then
If coord (1000, 500) = #FF09532 Then
Timer3.start()
Else
Timer2.stop()
Timer1.stop()
End If
End If
Okey, now i can make this Conditional, but i need how to equate this:
Because If i put the same color, Label2.text is "D:" and have to write "YEAH"...Code:Dim myBmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
If Label1.BackColor = mybmp.GetPixel(TextBox1.Text, TextBox2.Text) Then
label2.text = "YEAH"
Else
label2.text = "D:"
End If
Sorry for triple post.
SOLVED:
Code:
Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As IntPtr) As Integer
Public Declare Function GetPixel Lib "gdi32" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
____________________________________________________________________________________________________________________
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim myBmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
Dim g As Graphics = Graphics.FromImage(myBmp)
g.CopyFromScreen(Point.Empty, Point.Empty, myBmp.Size)
g.Dispose()
Label2.BackColor = myBmp.GetPixel(TextBox1.Text, TextBox2.Text)
myBmp.Dispose()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Timer2.Start()
End Sub
Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs) Handles Timer2.Tick
Dim myBmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
If Label2.BackColor = Label1.BackColor Then
Label2.Text = "YEAH"
Timer2.Stop()
Else
Label2.Text = "D:"
Timer2.Stop()
End If
End Sub