Sign in to follow this  

Pixel size and line thickness

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
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/style
dc->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 this post


Link to post
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?

Any hints please ..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

:-/

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this