コード例 #1
0
ファイル: Pattern.cs プロジェクト: vahidarr/DotSpatial
 /// <summary>
 /// Draws the borders for this graphics path by sequentially drawing all
 /// the strokes in the border symbolizer
 /// </summary>
 /// <param name="g">The Graphics device to draw to </param>
 /// <param name="gp">The GraphicsPath that describes the outline to draw</param>
 /// <param name="scaleWidth">The scaleWidth to use for scaling the line width </param>
 public virtual void DrawPath(Graphics g, GraphicsPath gp, double scaleWidth)
 {
     if (_innerPattern != null)
     {
         _innerPattern.DrawPath(g, gp, scaleWidth);
         return;
     }
     if (_useOutline && _outline != null)
     {
         _outline.DrawPath(g, gp, scaleWidth);
     }
 }
コード例 #2
0
ファイル: LineSymbolView.cs プロジェクト: rprouse/DotSpatial
        /// <summary>
        /// Draws the point symbol in the view.
        /// </summary>
        /// <param name="g">The graphics object used for drawing.</param>
        /// <param name="clip">The clip rectangle.</param>
        protected virtual void OnDraw(Graphics g, Rectangle clip)
        {
            if (BorderStyle == BorderStyle.Fixed3D)
            {
                g.DrawLine(Pens.White, 0, Height - 1, Width - 1, Height - 1);
                g.DrawLine(Pens.White, Width - 1, 0, Width - 1, Height - 1);
                g.DrawLine(Pens.Gray, 0, 0, 0, Height - 1);
                g.DrawLine(Pens.Gray, 0, 0, Width - 1, 0);
            }

            if (BorderStyle == BorderStyle.FixedSingle)
            {
                g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
            }

            int w = Width;
            int h = Height;

            if (_symbolizer == null)
            {
                return;
            }

            int lineWidth = Convert.ToInt32(_symbolizer.GetWidth());

            if (lineWidth > 128)
            {
                lineWidth = 128;
            }
            if (lineWidth < 1)
            {
                lineWidth = 1;
            }

            GraphicsPath gp = new();

            gp.AddLines(new[] { new Point(lineWidth, (h * 2) / 3), new Point(w / 3, h / 3), new Point((w * 2) / 3, (h * 2) / 3), new Point(w - lineWidth, h / 3) });
            _symbolizer.DrawPath(g, gp, 1);
        }