|
안녕하세요.
아래함수를 사용해 보세요!
void __fastcall DrawArrow(TCanvas* Canvas, TPoint Start, TPoint Stop)
{
double Length = 10;
double r2;
double r3 = 15;
if (Stop.x > Start.x)
r2 = (180.0 * atan((double)(Stop.y - Start.y)
/ (double)(Start.x - Stop.x))) / 3.141519;
else if (Stop.x < Start.x)
r2 = ((180.0 * atan((double)(Stop.y - Start.y)
/ (double)(Start.x - Stop.x))) / 3.141519) + 180;
else
{
if (Stop.y < Start.y)
r2 = 90;
else
r2 = -90;
}
TPoint a, b;
a = Point(Stop.x - (int)(Length * cos((3.141519 * (r2 + r3)) / 180)),
Stop.y + (int)(Length * sin((3.141519 * (r2 + r3)) / 180)));
b = Point(Stop.x - (int)(Length * cos((3.141519 * (r2 - r3)) / 180)),
Stop.y + (int)(Length * sin((3.141519 * (r2 - r3)) / 180)));
TPoint Points[3];
Points[0] = Stop;
Points[1] = a;
Points[2] = b;
Canvas->Brush->Color = clBlack;
Canvas->Polygon(Points, 2);
Canvas->MoveTo(Start.x, Start.y);
Canvas->LineTo(Stop.x, Stop.y);
}
|