Solved

Read Pixel from Screen ( using VB.NET)

Posted on 2003-12-09
8
3,056 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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
 
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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