private bool DrawSelectedObject(Graphics g) { if (SelectedObject != null && drawnObjects.Contains(SelectedObject)) { var body = SelectedObject; double sd = (body is SizeableCelestialObject) ? (body as SizeableCelestialObject).Semidiameter : 0; double size = Math.Max(10, mapContext.GetDiskSize(sd)); // do not draw selection circle if image is too large bool drawCircle = true; // diam / 2 < diag; if (drawCircle) { PointF p = Projection.Project(body.Horizontal); Pen pen = new Pen(Brushes.DarkRed, 2); pen.DashStyle = DashStyle.Dash; g.DrawEllipse(pen, (float)(p.X - (size + 6) / 2), (float)(p.Y - (size + 6) / 2), (float)(size + 6), (float)(size + 6)); return(true); } } return(false); }