the black hole 
it all ends here. 
bhC login
name:
pass:
 
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!
articles
 
rpg theory (7)
directx in vb (3)
vb rpg programming (4)
miscellaneous (4)
files
 
rpg / tile engine source (23)
full vb games w/ source (5)
'helper' libraries and utilities (13)
effect samples (5)
miscellaneous (10)
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!
links
 
vb rpg programming (5)
vb gaming (14)
general game programming (6)
vb sites (6)
miscellaneous (2)
general rpg programming (2)
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



pages: prev | 1 | next