在C++中使用GDI+绘制带箭头的线,箭头大小可调

Graphics g(pDc->m_hDC);

g.SetSmoothingMode(SmoothingModeHighQuality);

Color* attibute_color=(Color*)m_attributes[1]->pData;
Color color(attibute_color->GetAlpha(),attibute_color->GetRed(),attibute_color->GetGreen(),attibute_color->GetBlue());
    int line_width=m_attributes[0]->intvalue;
Pen pen(color,line_width);

//设置箭头大小
AdjustableArrowCap cap(4,4,true);
pen.SetCustomEndCap(&cap);

CPoint srcpoint = GetSrcPoint();
CPoint destpoint = GetDestPoint();

g.DrawLine(&pen,srcpoint.x,srcpoint.y,destpoint.x,destpoint.y);

posted @ 2015-11-04 16:31  爱好奇  阅读(1750)  评论(0编辑  收藏  举报