constructs a function that draws a line with arrows between Startpoint,endpoint:voidCtry1view::D rawline (Point startPoint, point endPoint) {CCLIENTDC DC ( This);d c. MoveTo (StartPoint);d C. LineTo (endPoint);DoublePI =3.1415926;Doublet=pi/4;//angle between arrow and straight lineDoubleL=0.2;//the length of the arrow edge as a percentage of the line lengthPoint arrowpoint;arrowpoint.x= (int) (l* ((startpoint.x-endpoint.x) *cos (t)-(STARTPOINT.Y-ENDPOINT.Y) *sin (t)) +endpoint.x); Arrowpoint.y= (int) (l* ((startpoint.x-endpoint.x) *sin (t) + (STARTPOINT.Y-ENDPOINT.Y) *cos (t)) +endpoint.y);d c. MoveTo (EndPoint);d C. LineTo (arrowpoint); Arrowpoint.x= (int) (l* (Startpoint.x-endpoint.x) *cos (-T)-(STARTPOINT.Y-ENDPOINT.Y) *sin (-t)) +endpoint.x); Arrowpoint.y= (int) (l* (Startpoint.x-endpoint.x) *sin (-T) + (STARTPOINT.Y-ENDPOINT.Y) *cos (-T) +endpoint.y);d c. MoveTo (EndPoint);d C. LineTo (Arrowpoint);}
MFC draws a straight line with arrows