Click to See Complete Forum and Search --> : Simple Graphics Question
chilibean
May 5th, 2001, 03:13 PM
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
Vlatko
May 5th, 2001, 03:25 PM
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
);
SetPixel(hdc,posx,posy,RGB(0,0,0));
chilibean
May 5th, 2001, 04:05 PM
Is there a way to specify the size of the dot?
Just like: Me.DrawWidth = 6
Thanks
chilibean
parksie
May 5th, 2001, 05:31 PM
Yes. Draw an ellipse, rectangle, whatever.
HarryW
May 5th, 2001, 05:40 PM
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).
chilibean
May 5th, 2001, 06:49 PM
Thank you all for helping me out. I got all the answers I need.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.