bool CTestDlg::DrawHorDotLine(CDC *pDc, int x1, int y1, int x2, int y2)
{
//水平虚线
int nGap=10;
for (int i=0; (nGap*i+x1)<x2; i++)
{
pDc->MoveTo(min(nGap*(i*2)+x1, x2), y1);
pDc->LineTo(min(nGap*(i*2+1)+x1, x2), y2);
}
return true;
}
bool CTestDlg::DrawVerDotLine(CDC *pDc, int x1, int y1, int x2, int y2)
{
//竖直虚线
int nGap=10;
for (int i=0; (nGap*i+y1)<y2; i++)
{
pDc->MoveTo(x1, min(nGap*(i*2)+y1, y2));
pDc->LineTo(x2, min(nGap*(i*2+1)+y1, y2));
}
return true;
}
时间仓促,等有空画斜虚线。