Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleFill a large area one pixel at a time using PSet
Keywordsgraphics, PSet, pixel
CategoriesGraphics
 
See my book Visual Basic Graphics Programming for more information on graphics in Visual Basic.

The method

    PSet(X, Y), color

sets the color of the pixel at (X, Y).

 
For Y = 0 To hgt - 1
    For X = 0 To wid - 1
        If (X \ 20) Mod 2 = (Y \ 20) Mod 2 Then
            Picture1.PSet (X, Y), vbBlack
        Else
            Picture1.PSet (X, Y), clr
        End If
    Next X
Next Y

' Display the image.
Picture1.Picture = Picture1.Image
 
This program, together with the following programs, compares the speeds of different methods for manipulating an image's pixels one at a time.

 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated