/// <summary> /// Draws the rectangle on the provided Graphics /// </summary> /// <param name="g">The graphics on which the drawing happens</param> /// <param name="ViewInfo">Information about the current map view</param> public void Draw(Graphics g, MapViewInfo ViewInfo) { Point p1 = ViewInfo.MapToControl(new Point(m_Location.X, m_Location.Y)); Point p2 = ViewInfo.MapToControl(new Point(m_Location.Right, m_Location.Bottom)); Brush borderBrush = new SolidBrush(m_Color); Pen borderPen = new Pen(borderBrush); g.DrawRectangle(borderPen, p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y); if (m_Fill) { Brush fillBrush = new SolidBrush(m_FillColor); g.FillRectangle(fillBrush, p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y); } }
/// <summary> /// Draws the rectangle on the provided Graphics /// </summary> /// <param name="g">The graphics on which the drawing happens</param> /// <param name="ViewInfo">Information about the current map view</param> public void Draw(Graphics g, MapViewInfo ViewInfo) { Point p = ViewInfo.MapToControl(m_Location); int x = p.X; int y = p.Y; Brush brush = new SolidBrush(m_Color); Pen pen = new Pen(brush); g.DrawLine(pen, x - m_Length, y, x + m_Length, y); g.DrawLine(pen, x, y - m_Length, x, y + m_Length); }
/// <summary> /// Draws the circle /// </summary> /// <param name="g">The Graphics object used for the drawing</param> /// <param name="ViewInfo">Information about the current map view</param> public void Draw(Graphics g, MapViewInfo ViewInfo) { // Draw at specified location Point p = ViewInfo.MapToControl(m_Location); int x = p.X; int y = p.Y; Brush brush = new SolidBrush(m_Color); Pen pen = new Pen(brush); // Change radius accordingly to zoom level int radius = ViewInfo.MapToControl(m_Radius); // Draw the circle g.DrawEllipse(pen, x - radius, y - radius, radius * 2, radius * 2); if (m_Fill) { // Fill it brush = new SolidBrush(m_FillColor); g.FillEllipse(brush, x - radius, y - radius, radius * 2, radius * 2); } }