[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3106
  • Last Modified:

Read Pixel from Screen ( using VB.NET)

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
arvindb1
Asked:
arvindb1
  • 2
  • 2
  • 2
  • +2
1 Solution
 
rovermCommented:
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
Bob LearnedCommented:
Get the color of a pixel from a picture box image:

      Dim bm As Bitmap = Me.PictureBox1.Image
      bm.GetPixel(x, y)
0
 
iboutchkineCommented:
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
 
Bob LearnedCommented:
Is this still an open issue?
0
 
arvindb1Author Commented:
Yes, Currently i'm analyzing proposed solutions, pls. give me some time. i'll definitely get back.
Thanks
Arvind
0
 
arvindb1Author Commented:
Comment from testn has solved my problem
Thanks for help
Arvind
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now