I too had this problem in the past. I resorted to using LineDDA and a callback proc.
struct LineData{
CDC* pDC;
COLORREF crForegroundColor;
COLORREF crBackgroundColor;
};
.
.
.
LineData* pData = new LineData;
pData->crForegroundColor = crForegroundColor;
pData->crBackgroundColor = crBackgroundColor;
pData->pDC = pdc;
LineDDA(nStartx, nStarty, nEndPointX, nEndPointY, LineDDAProc, (LPARAM) pData);
delete pData;
.
.
.
void
LineDDAProc(int x, int y, LPARAM lpData)
{
static short nTemp = 0;
LineData* pData = (LineData*) lpData;
if (nTemp == 1)
pData->pDC->SetPixel(x, y, pData->crForegroundColor);
else
pData->pDC->SetPixel(x, y, pData->crBackgroundColor);
nTemp = (nTemp + 1) % 2;
}
Might not be the most efficient drawing algorithm, but you're now in complete control of dot spacing as well. I went with this approach because there were other non-native pen styles I was using for line rendering which used a bit pattern. I then walked the bit and used setpixel for the 'on' bits. It worked well and increased the useful linestyles.