Dxflib realizes the parsing of DXF file. After all the elements have been parsed, they will be dl_creationadapter through the virtual function interface callback, so we will inherit this class and rewrite the methods of the elements we want to draw, such as a line corresponding to the virtual void AddLine (const dl_linedata &); The DL_LINEDATA structure data holds the data that we want to draw straight lines.
I am using the MFC CDC, a double buffering mechanism. Draw all the entities into the memory buffer according to the data, and then copy them to the window DC. It is worth noting that panning and zooming and coordinate system transformations. Because the upper-left corner of the application is the origin (0,0), the face we need to show is the y-axis positive direction is the screen from bottom to top. (The actual y-direction of the screen is up and down). Only points, lines, circles, arcs, polygons, splines (including with control points, and vertices), and a single line of text are implemented. Like Linetype, line color, multiline text, ellipse these are not implemented. But dxflib this information can be resolved, only in accordance with the rules in theory is achievable.
The results are as follows:
The above image is enlarged with the following effect:
Other effects: