Joao Paulo Figueira (joao.fig@mail.telepac.pt), June 8, 2003.
The MoveTo and LineTo HDC methods are not supported. How can I implement them?
Assuming that you are doing straight API development with the GDI, you will not find these methods. They are not natively supported by the GDI, and are simulated in MFC 3.0. The solution lies on the Polyline function. This function takes as parameters a handle to the device context, a POINT array and the size of the array.
Here is how you might implement a simple Line function:
To simulate the MoveTo and LineTo functions, you will need to store the initial point set by MoveTo in a variable and then, in the LineTo function, use an approach similar to the one used above. The drawback of this method is that the initial point set by MoveTo is independent of the HDC. A better approach would be to encapsulate the DC handle in a C++ class, and store there the initial point. This way, you would have a connection between HDC and initial point.