Solved

Read Pixel from Screen ( using VB.NET)

Posted on 2003-12-09
8
3,052 Views
Last Modified: 2007-12-19
VB.NET Windows Application

If someone clicks on a pixel on a screen how can the pixel color be read e.g. in Mouse down event

Is it possible to access the screen as a bitmap? i.e. copy a specific area of the screen content into a bitmap.

Arvind

0
Comment
Question by:arvindb1
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 9903018
0
 
LVL 18

Expert Comment

by:testn
ID: 9903442
0
 
LVL 18

Accepted Solution

by:
testn earned 500 total points
ID: 9903445
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9904825
Get the color of a pixel from a picture box image:

      Dim bm As Bitmap = Me.PictureBox1.Image
      bm.GetPixel(x, y)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

Expert Comment

by:iboutchkine
ID: 9912538
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
        'get the picture box's bitmap into the "bitmap " variable
        Dim bitmap As Bitmap = PictureBox1.Image
        'get the color at the X,Y position, using the event (e) object
        Dim color As Color = bitmap.GetPixel(e.X, e.Y)
        'get the RGB value
        Dim ColorValue As Integer = color.ToArgb

        'extract the red, and set the form's caption
        Me.Text = "Red = " & CStr((ColorValue And &HFF0000) \ &H10000) & _
        " Green = " & CStr((ColorValue And &HFF0000) \ &H100) & _
        " Blue = " & CStr((ColorValue And &HFF0000) \ &H1)
    End Sub
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9930625
Is this still an open issue?
0
 
LVL 5

Author Comment

by:arvindb1
ID: 9933326
Yes, Currently i'm analyzing proposed solutions, pls. give me some time. i'll definitely get back.
Thanks
Arvind
0
 
LVL 5

Author Comment

by:arvindb1
ID: 9933800
Comment from testn has solved my problem
Thanks for help
Arvind
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 4 156
Redacting a row in Excel based on a term. 17 53
Need a complete list of ASP.NET page load events 3 25
Get Client IP on RDS - VB.NET 15 15
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now