Click to See Complete Forum and Search --> : "Empty" line with "LineTo" function


lpopovici
April 6th, 2005, 08:50 AM
Hello!

I would like to draw an "empty" line (only the contour of the line is visible) using the "LineTo" function. See the attached pictures.
With the "LineTo" function, after choosing a thick CPen object, there is no problem to draw a normal, solid (PS_SOLID) line.
Is there any chance to make this using the normal C++ functions, or I have to use some assembler code?

Thank you!
Laurentiu

MrViggy
April 6th, 2005, 03:55 PM
I think you can by using paths. See CDC::BeginPath (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cdc.3a3a.beginpath.asp) or ::BeginPath (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/paths_4ciw.asp) for an example.

In a nutshell, you begin a path; draw your object with your wide pen; end the path; then get all the points that make up the edge of the path. It may not be real pretty, in other words, you may not get the "complete" circles at the endpoints in your examples. However, that's easy for you to fix with a couple calls to "CDC::Ellipse" ;)

Oh, yeah, needless to say, you want to do the path creation on a memory device context (search the forums for "double buffering"), not the actual screen context.

Viggy