home |
the black hole's front page. all the latest vb rpg development and vbgaming news, as well as this week's feature rpg project! |
rpg projects
|
vb rpg projects under development by members of the bhC. show them your
support, and check out their games! |
message board |
a forum to interact with your fellow vb rpg programmers. you do *not* have
to be a bhC member to post! |
contact |
you want to contact the guy behind the black hole? here's where to
do it! |
|
|
 |
|
<< Back to Category List
SetPixel - Setting a Pixel Color - page 1 |
pages:
prev | 1 | next
SetPixel, like GetPixel, is a member of the Windows API. It is used to set the pixel color of an object at an (X, Y) location determined by you. To begin, add the following to a new or existing module within your current project.
| Declare Function SetPixel Lib "gdi32" Alias "SetPixel" _
(ByVal hDC As Long, ByVal x As Long, ByVal y As Long, _
ByVal crColor As Long) As Long
To use this function, begin by changing your Form's name to frmMain. Also, set its ScaleMode to 3 (pixel). Now add the following code to your Form_MouseDown procedure.
| Call SetPixel(frmMain.hDC, X, Y, vbRed)
When you run the porgram, a red pixel will be placed anywhere you click on the form. I hope you found this tutorial useful, good luck!
| Matt Huggins
Nobis Productions
|