This method sets a color in the specified pixel in the designated object (screen, or image data).
Parameters
Name | Explanation |
---|---|
DeviceValue | The device context or the raster image data (i.e. Hdc or ImageHandle) |
x,y | The x,y coordinates of the pixel |
Color | The new color of the pixel |
DeviceMode | The designated object where the pixel color is set (0: Screen, 2: Image data) |
In Visual Basic the following constants can be used: (ikScreen = 0, ikMemoryHandle = 2).
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The SetPixel method sets a color specified by the Color parameter into the pixel whose coordinates are specified by the x and y parameters. To set the Color parameter, use the RGB(red, green, blue) value. If the specified color can not be accurately produced by the device, the nearest color is used.
This method can draw in the following designated objects: screen and image data. This method is enabled when the DeviceMode parameter is 0 or 2 (the designated object is the screen or the image data). Please set the x and y parameters in pixel units.
Note: In the Visual Basic PictureBox, please set the AutoRedraw property to True.