void CAsDlg::DrawArrowhead(CDC *pDC, int x0, int y0, int x, int y, int archor_width)
{
/*****************************************/
//
// 参数:pDC 设备DC
//
// x0,y0,x,y 箭头的起点和终点
//
// archor_width = 箭頭寬度
//
/******************************************/
int x2,y2,x3,y3;
double a=atan((double)(x0-x)/(double)(y-y0));
x2=30*sin(a+PI/6+2*PI)+x;
y2=y-30*cos(a+PI/6+2*PI);
x3=30*sin(a-PI/6+2*PI)+x;
y3=y-30*cos(a-PI/6+2*PI);
pDC->MoveTo(y0,x0);
pDC->LineTo(y,x);
pDC->MoveTo(y2,x2);
pDC->LineTo(y,x);
pDC->MoveTo(y3,x3);
pDC->LineTo(y,x);
}
VC++ 箭头的画法
最新推荐文章于 2018-06-29 11:14:00 发布