Pixel size and line thickness
I have a MFC application which can plot data points in a graph.
1. Is it possible that while plotting a pixel point, I could change the size of it?
The code which I have used:
CDC *dc;
CPoint cPt;
cPt.x = 0.1;
cPt.y = 0.1;
dc->SetPixel(cPt,cRGB); // CRGB is an instance of COLORREF
2. Is it possible to change the default thickness of the line?
For drawing the line:
dc->LineTo(cPt);
Thanks a lot
To change the thickness of a line, you'll have to change the pen you are using :
Not sure but it may also change the pixel size (not tested... I haven't drawn a pixel using SetPixel() for at least 5 years :)
HTH
CPen pen(PS_SOLID, 5 /*thickness*/, RGB(0,0,0));CPen *oldpen;// new thickness/color/styleoldpen = dc->SelectObject(&pen);dc->LineTo(pt);// return to the original thickness/color/styledc->SelectObject(oldpen);
Not sure but it may also change the pixel size (not tested... I haven't drawn a pixel using SetPixel() for at least 5 years :)
HTH
Specifying the thickness in CPen worked for drawing the line but did not work for the increasing the pixel size ..
How do you plot a point in MFC and specify the size of it?
Any hints please ..
Quote:Original post by calvinhobbs
Specifying the thickness in CPen worked for drawing the line but did not work for the increasing the pixel size ..
How do you plot a point in MFC and specify the size of it?
Any hints please ..
uh, the physical size (i.e. size as seen on the display) of a pixel is determined by your resolution. if you want to draw an arbitrarily sized point, then you need to draw multiple pixels (the smallest point, of course, is the size of a pixel).
btw.. you could just draw a line which is one-unit long, to draw a 'point'. then you can use the pen to determine the size of such a point.
:-/
:-/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement