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
Printable View
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
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));
Is there a way to specify the size of the dot?
Just like: Me.DrawWidth = 6
Thanks
chilibean
Yes. Draw an ellipse, rectangle, whatever.
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).
Thank you all for helping me out. I got all the answers I need.