• 12
• 15
• 19
• 27
• 9

# Pixel size and line thickness

This topic is 4957 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
To change the thickness of a line, you'll have to change the pen you are using :

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

##### Share on other sites

Great!! .. it worked .. thanks a lot .. ratings++

##### Share on other sites

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?

##### Share on other sites
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).