jhylands

Get pixel colour basic

Jun 23rd, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.77 KB | None | 0 0
  1. Option Strict Off
  2. Option Explicit On
  3. Imports VB = Microsoft.VisualBasic
  4. Imports System.Runtime.InteropServices
  5.  
  6. Friend Class Form1
  7.     Inherits System.Windows.Forms.Form
  8.  
  9.     Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Integer) As Integer
  10.     Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer
  11.  
  12.     Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
  13.         Timer1.Interval = 100
  14.         Timer1.Enabled = True
  15.     End Sub
  16.  
  17.     Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick
  18.         Dim lColor As Integer = GetPixel(GetDC(0), 10, 10)
  19.     End Sub
  20. End Class
Advertisement
Add Comment
Please, Sign In to add comment