|
-
May 5th, 2001, 03:13 PM
#1
Thread Starter
Member
Simple Graphics Question
What is the closest translation of
Me.PSet (posx, posy), vbBlack
into C++ using API?
The shape does not have to be circular, but I must be able to change the color (vbGreen, vbRed).
PS I am using VC++ 6.0
-
May 5th, 2001, 03:25 PM
#2
Frenzied Member
Code:
SetPixel
The SetPixel function sets the pixel at the specified coordinates to the specified color.
COLORREF SetPixel(
HDC hdc, // handle to device context
int X, // x-coordinate of pixel
int Y, // y-coordinate of pixel
COLORREF crColor // pixel color
);
Code:
SetPixel(hdc,posx,posy,RGB(0,0,0));
-
May 5th, 2001, 04:05 PM
#3
Thread Starter
Member
Size???
Is there a way to specify the size of the dot?
Just like: Me.DrawWidth = 6
Thanks
chilibean
-
May 5th, 2001, 05:31 PM
#4
Monday Morning Lunatic
Yes. Draw an ellipse, rectangle, whatever.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
May 5th, 2001, 05:40 PM
#5
Frenzied Member
SetPixel does exactly what it says, it sets one pixel. Like Parksie suggests, if you want to draw a bigger dot then either use SetPixel on several adjacent pixels, or use a different GDI function like Rectangle() or Ellipse() (these draw squares and circles too, with the right parameters). You will have to set the pen and brush for the DC to whatever colours you want to draw the dot in (the pen is the outline, the brush is the fill, in case you didn't know).
Harry.
"From one thing, know ten thousand things."
-
May 5th, 2001, 06:49 PM
#6
Thread Starter
Member
Thank you
Thank you all for helping me out. I got all the answers I need.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|