you can write your own little routine.
I just wrote up my own DrawArrow routine:
private void DrawArrow(Graphics g, PointF ArrowStart, PointF ArrowEnd, Color ArrowColor, int LineWidth, int ArrowMultiplier)
{
Pen p = new Pen(ArrowColor, LineWidth);
g.DrawLine(p, ArrowStart, ArrowEnd);
PointF arrowPoint = ArrowEnd;
double arrowLength = Math.Sqrt(Math.Pow(Math.Abs(ArrowStart.X - ArrowEnd.X), 2) +
Math.Pow(Math.Abs(ArrowStart.Y - ArrowEnd.Y), 2));
double arrowAngle = Math.Atan2(Math.Abs(ArrowStart.Y - ArrowEnd.Y),Math.Abs(ArrowStart.X - ArrowEnd.X));
double pointX, pointY;
if (ArrowStart.X > ArrowEnd.X)
{
pointX = ArrowStart.X - (Math.Cos(arrowAngle) * (arrowLength - (3 * ArrowMultiplier)));
}
else
{
pointX = Math.Cos(arrowAngle) * (arrowLength - (3 * ArrowMultiplier)) + ArrowStart.X;
}
if (ArrowStart.Y > ArrowEnd.Y)
{
pointY = ArrowStart.Y - (Math.Sin(arrowAngle) * (arrowLength - (3 * ArrowMultiplier)));
}
else
{
pointY = (Math.Sin(arrowAngle) * (arrowLength - (3 * ArrowMultiplier))) + ArrowStart.Y;
}
PointF arrowPointBack = new PointF((float)pointX, (float)pointY);
double angleB = Math.Atan2((3 * ArrowMultiplier), (arrowLength - (3 * ArrowMultiplier)));
double angleC = Math.PI * (90 - (arrowAngle * (180 / Math.PI)) - (angleB * (180 / Math.PI))) / 180;
double secondaryLength = (3 * ArrowMultiplier)/Math.Sin(angleB);
if (ArrowStart.X > ArrowEnd.X)
{
pointX = ArrowStart.X - (Math.Sin(angleC) * secondaryLength);
}
else
{
pointX = (Math.Sin(angleC) * secondaryLength) + ArrowStart.X;
}
if (ArrowStart.Y > ArrowEnd.Y)
{
pointY = ArrowStart.Y - (Math.Cos(angleC) * secondaryLength);
}
else
{
pointY = (Math.Cos(angleC) * secondaryLength) + ArrowStart.Y;
}
PointF arrowPointLeft = new PointF((float)pointX, (float)pointY);
angleC = arrowAngle - angleB;
if (ArrowStart.X > ArrowEnd.X)
{
pointX = ArrowStart.X - (Math.Cos(angleC) * secondaryLength);
}
else
{
pointX = (Math.Cos(angleC) * secondaryLength) + ArrowStart.X;
}
if (ArrowStart.Y > ArrowEnd.Y)
{
pointY = ArrowStart.Y - (Math.Sin(angleC) * secondaryLength);
}
else
{
pointY = (Math.Sin(angleC) * secondaryLength) + ArrowStart.Y;
}
PointF arrowPointRight = new PointF((float)pointX,(float)pointY);
PointF[] arrowPoints = new PointF[4];
arrowPoints[0] = arrowPoint;
arrowPoints[1] = arrowPointLeft;
arrowPoints[2] = arrowPointBack;
arrowPoints[3] = arrowPointRight;
g.DrawPolygon(p, arrowPoints);
g.FillPolygon(new SolidBrush(ArrowColor), arrowPoints);
}
to test it, I added a panel and two textboxes to a form and added two simple mouse events:
PointF mouseStart;
PointF mouseEnd;
private void panel1_MouseDown(object sender, MouseEventArgs e)
{
mouseStart = new PointF(e.X, e.Y);
}
private void panel1_MouseUp(object sender, MouseEventArgs e)
{
mouseEnd = new PointF
(e.X, e.Y);
panel1.CreateGraphics().Clear(Form1.DefaultBackColor);
DrawArrow(panel1.CreateGraphics(), mouseStart, mouseEnd, Color.Black,
Convert.ToInt16(txtLineWidth.Text), Convert.ToInt16(txtArrowMultiplier.Text));
}
worked like a charm. You can change the line width or the size of the arrow independently.
[Modified: changed from Point to PointF for slightly more accurate points, also included a comment on how to change from an arrow to a diamond...(requires changing the code that calculates the arrowPointBack)]