public class TriangleCursor : GoRulerCursor {
public TriangleCursor() {
this.Size = new Size(10, 20);
this.ForeColor = Color.Blue;
this.BackColor = Color.LightBlue;
}
public override void Paint(Graphics g, GoRuler ruler, float measure) {
Pen p = new Pen(this.ForeColor, 0);
Brush b = new SolidBrush(this.BackColor);
Rectangle r = ruler.DisplayRectangle;
float left = measure - this.Width/2.0f;
float right = measure + this.Width/2.0f;
PointF[] pts;
if (ruler.Orientation == Orientation.Horizontal)
pts = new PointF[] {new PointF(left, r.Y), new PointF(right, r.Y), new PointF(measure, r.Bottom)};
else
pts = new PointF[] {new PointF(r.X, left), new PointF(r.X, right), new PointF(r.Right, measure)};
g.FillPolygon(b, pts);
g.DrawPolygon(p, pts);
b.Dispose();
p.Dispose();
}
}