| ' Get the picture's image.
GetBitmapPixels Picture1, pixels, bits_per_pixel
' Make RGBTriplet values for the new color.
If use_red Then
    to_pixel.rgbRed = 255
Else
    to_pixel.rgbBlue = 255
End If
use_red = Not use_red
wid = UBound(pixels, 1)
hgt = UBound(pixels, 2)
For Y = 0 To hgt - 1
    For X = 0 To wid - 1
        If (X \ 20) Mod 2 = (Y \ 20) Mod 2 Then
            pixels(X, Y) = black_pixel
        Else
            pixels(X, Y) = to_pixel
        End If
    Next X
Next Y
' Display the image.
SetBitmapPixels Picture1, bits_per_pixel, pixels
Picture1.Picture = Picture1.Image |