Results 1 to 3 of 3

Thread: SetPixel and GetPixel How do you use them?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67

    Talking

    How do I use SetPixel and GetPixel?
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Here's an example, getpixel is the same as point and setpixelv is the same as pset, except api's faster and you need to specify the dc
    Code:
    'In declarations
    Declare Function SetPixelV Lib "gdi32" Alias "SetPixelV" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
    Declare Function GetPixel Lib "gdi32" Alias "GetPixel" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
    
    'In code
    
    Dim Color&
    color = getpixel(picture1.hdc,10,10)
    setpixelv picture2.hdc,15,5,vbred
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    Aslo, you should remember to set your Form's Autoredraw property to true and remember to refresh the Form after you have drawn on the DC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width