当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.DrawPath方法代码示例

本文整理汇总了C#中System.Drawing.Graphics.DrawPath方法的典型用法代码示例。如果您正苦于以下问题:C# Graphics.DrawPath方法的具体用法?C# Graphics.DrawPath怎么用?C# Graphics.DrawPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Drawing.Graphics的用法示例。


在下文中一共展示了Graphics.DrawPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Draw

        protected override void Draw(Graphics g)
        {
            if (points.Count > 2)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;

                if (Config.UseDimming)
                {
                    using (Region region = new Region(regionFillPath))
                    {
                        g.Clip = region;
                        g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                        g.ResetClip();
                    }
                }

                g.DrawPath(borderPen, regionFillPath);
                g.DrawPath(borderDotPen, regionFillPath);
                g.DrawLine(borderPen, points[points.Count - 1], points[0]);
                g.DrawLine(borderDotPen, points[points.Count - 1], points[0]);
                g.DrawRectangleProper(borderPen, currentArea);
            }

            base.Draw(g);
        }
开发者ID:andre-d,项目名称:ShareXYZ,代码行数:25,代码来源:FreeHandRegion.cs

示例2: Draw

        protected override void Draw(Graphics g)
        {
            if (points.Count > 2)
            {
                g.SmoothingMode = SmoothingMode.HighQuality;

                borderDotPen.DashOffset = (float)timer.Elapsed.TotalSeconds * 10;
                borderDotPen2.DashOffset = 5 + (float)timer.Elapsed.TotalSeconds * 10;

                using (Region region = new Region(regionFillPath))
                {
                    g.Clip = region;
                    g.FillRectangle(lightBackgroundBrush, ScreenRectangle0Based);
                    g.ResetClip();
                }

                g.DrawPath(borderDotPen, regionFillPath);
                g.DrawPath(borderDotPen2, regionFillPath);
                g.DrawLine(borderDotPen, points[points.Count - 1], points[0]);
                g.DrawLine(borderDotPen2, points[points.Count - 1], points[0]);
                g.DrawRectangleProper(borderPen, currentArea);
            }

            base.Draw(g);
        }
开发者ID:TreeSeed,项目名称:ShareX,代码行数:25,代码来源:FreeHandRegion.cs

示例3: DrawRoundRectangle

 public static void DrawRoundRectangle(Graphics g, Pen pen, Rectangle rect, int cornerRadius)
 {
     using (GraphicsPath path = CreateRoundedRectanglePath(rect, cornerRadius))
     {
         g.DrawPath(pen, path);
     }
 }
开发者ID:wawa0210,项目名称:jgq,代码行数:7,代码来源:ValidateCode.aspx.cs

示例4: DrawLabel

        /// <summary>
        /// Renders a label to the map.
        /// </summary>
        /// <param name="graphics">Graphics reference</param>
        /// <param name="labelPoint">Label placement</param>
        /// <param name="offset">Offset of label in screen coordinates</param>
        /// <param name="font">Font used for rendering</param>
        /// <param name="forecolor">Font forecolor</param>
        /// <param name="backcolor">Background color</param>
        /// <param name="halo">Color of halo</param>
        /// <param name="rotation">Text rotation in degrees</param>
        /// <param name="text">Text to render</param>
        /// <param name="viewport"></param>
        public static void DrawLabel(Graphics graphics, Point labelPoint, Offset offset, Styles.Font font, Styles.Color forecolor, Styles.Brush backcolor, Styles.Pen halo, double rotation, string text, IViewport viewport, StyleContext context)
        {
            SizeF fontSize = graphics.MeasureString(text, font.ToGdi(context)); //Calculate the size of the text
            labelPoint.X += offset.X; labelPoint.Y += offset.Y; //add label offset
            if (Math.Abs(rotation) > Constants.Epsilon && !double.IsNaN(rotation))
            {
                graphics.TranslateTransform((float)labelPoint.X, (float)labelPoint.Y);
                graphics.RotateTransform((float)rotation);
                graphics.TranslateTransform(-fontSize.Width / 2, -fontSize.Height / 2);
                if (backcolor != null && backcolor.ToGdi(context) != Brushes.Transparent)
                    graphics.FillRectangle(backcolor.ToGdi(context), 0, 0, fontSize.Width * 0.74f + 1f, fontSize.Height * 0.74f);
                var path = new GraphicsPath();
                path.AddString(text, new FontFamily(font.FontFamily), (int)font.ToGdi(context).Style, font.ToGdi(context).Size, new System.Drawing.Point(0, 0), null);
                if (halo != null)
                    graphics.DrawPath(halo.ToGdi(context), path);
                graphics.FillPath(new SolidBrush(forecolor.ToGdi()), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), 0, 0);
            }
            else
            {
                if (backcolor != null && backcolor.ToGdi(context) != Brushes.Transparent)
                    graphics.FillRectangle(backcolor.ToGdi(context), (float)labelPoint.X, (float)labelPoint.Y, fontSize.Width * 0.74f + 1, fontSize.Height * 0.74f);

                var path = new GraphicsPath();

                //Arial hack
                path.AddString(text, new FontFamily("Arial"), (int)font.ToGdi(context).Style, (float)font.Size, new System.Drawing.Point((int)labelPoint.X, (int)labelPoint.Y), null);
                if (halo != null)
                    graphics.DrawPath(halo.ToGdi(context), path);
                graphics.FillPath(new SolidBrush(forecolor.ToGdi()), path);
                //g.DrawString(text, font, new System.Drawing.SolidBrush(forecolor), LabelPoint.X, LabelPoint.Y);
            }
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:46,代码来源:LabelRenderer.cs

示例5: Draw

        /// <summary>
        /// This routine draws the animated bomb
        /// using two toggling graphics paths
        /// giving the effect of a spinning bomb
        /// </summary>
        /// <param name="g"></param>
        public override void Draw(Graphics g)
        {
            UpdateBounds();
            Matrix m = new Matrix();

            m.Translate(MovingBounds.Left, MovingBounds.Top);
            // g.FillRectangle(Brushes.White , MovingBounds);
            if (_invert)
            {

                bombInTransformed = (GraphicsPath)bombIn.Clone();
                bombInTransformed.Transform(m);
                g.DrawPath(BombPen, bombInTransformed);
                bombInTransformed.Dispose();
            }
            else
            {
                bombOutTransformed = (GraphicsPath)bombOut.Clone();
                bombOutTransformed.Transform(m);
                g.DrawPath(BombPen, bombOutTransformed);
                bombOutTransformed.Dispose();
            }

              /*          Matrix flipMatrix = new Matrix();
            flipMatrix.Scale(-1.0f, 1.0f);

            m.Translate(MovingBounds.Left, MovingBounds.Top);

            if (_invert)
            {
                m.Scale(-1, 1);  // flip around the y axis
            }

            // g.FillRectangle(Brushes.White , MovingBounds);
                bombInTransformed = (GraphicsPath)bombIn.Clone();
                bombInTransformed.Transform(m);

                g.DrawPath(BombPen, bombInTransformed);
                bombInTransformed.Dispose();
            */

            _invert = !_invert;

            //            g.DrawPolygon(Pens.White, new PointF[]{new PointF(Position.X, Position.Y),
            //                                                   new PointF(Position.X + width, Position.Y + seg),
            //                                                   new PointF(Position.X, Position.Y + seg*2),
            //                                                    new PointF(Position.X + 3, Position.Y + seg*3)});

            Position.Y += TheBombInterval;
        }
开发者ID:brayanrp215,项目名称:Recursos,代码行数:56,代码来源:Bomb.cs

示例6: DrawGlow

 private void DrawGlow(Graphics g)
 {
     GraphicsPath p = new GraphicsPath();
     Point [] border = {
                         new Point(0			, 0			),
                         new Point(Width-1	, 0			),
                         new Point(Width-1	, Height-1	),
                         new Point(0			, Height-1	)
                     };
     p.AddPolygon(border);
     g.SmoothingMode = SmoothingMode.AntiAlias;
     g.DrawPath(new Pen(Color.Gold, 3), p);
     g.DrawPath(new Pen(Color.FromArgb(200, Color.White), 1), p);
 }
开发者ID:Foxious,项目名称:phEngine,代码行数:14,代码来源:DragDot.cs

示例7: DrawTab

        public override void DrawTab(Graphics gr, Rectangle borderrect, int index, bool selected, Color color1, Color color2, Color coloroutline, TabAlignment alignment)
        {
            GraphicsPath border = new GraphicsPath();
            GraphicsPath fill = new GraphicsPath();

            int xfar = borderrect.Right - 1;

            int ybot = (alignment == TabAlignment.Bottom) ? (borderrect.Y) : (borderrect.Bottom - 1);
            int ytop = (alignment == TabAlignment.Bottom) ? (borderrect.Bottom-1-((selected)?0:2)) : (borderrect.Y - ((selected) ? 2 : 0));

            border.AddLine(borderrect.X, ybot, borderrect.X + shift, ytop);
            border.AddLine(borderrect.X + shift, ytop, xfar, ytop);
            border.AddLine(xfar, ytop, xfar + shift, ybot);

            fill.AddLine(borderrect.X, ybot + 1, borderrect.X + shift, ytop);
            fill.AddLine(borderrect.X + shift, ytop, xfar, ytop);
            fill.AddLine(xfar, ytop, xfar + shift, ybot + 1);

            gr.SmoothingMode = SmoothingMode.Default;

            using (Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(borderrect, color1, color2, 90))
                gr.FillPath(b, fill);

            gr.SmoothingMode = SmoothingMode.AntiAlias;

            using (Pen p = new Pen(coloroutline, 1.0F))
                gr.DrawPath(p, border);
        }
开发者ID:vendolis,项目名称:EDDiscovery,代码行数:28,代码来源:TabStyleCustom.cs

示例8: DrawTab

        public override void DrawTab(Graphics gr, Rectangle borderrect, int index, bool selected, Color color1, Color color2, Color coloroutline)
        {
            int additional = 0;                             // extra depth for fill

            if (selected)
            {
                additional = 1;
                borderrect.Height += borderrect.Y;          // this one uses any height to get it bigger
                borderrect.Y = 0;
            }

            int xfar = borderrect.Right - 1;
            int yfar = borderrect.Bottom - 1;

            GraphicsPath border = new GraphicsPath();
            border.AddLine(borderrect.X, yfar + additional, borderrect.X + shift, borderrect.Y);
            border.AddLine(borderrect.X + shift, borderrect.Y, xfar, borderrect.Y);
            border.AddLine(xfar, borderrect.Y, xfar + shift, yfar + additional);

            GraphicsPath fill = new GraphicsPath();
            fill.AddLine(borderrect.X, yfar + additional + 1, borderrect.X + shift, borderrect.Y);
            fill.AddLine(borderrect.X + shift, borderrect.Y, xfar, borderrect.Y);
            fill.AddLine(xfar, borderrect.Y, xfar + shift, yfar + additional + 1);

            gr.SmoothingMode = SmoothingMode.Default;

            using (Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(borderrect, color1, color2, 90))
                gr.FillPath(b, fill);

            gr.SmoothingMode = SmoothingMode.AntiAlias;

            using (Pen p = new Pen(coloroutline, 1.0F))
                gr.DrawPath(p, border);
        }
开发者ID:amatos,项目名称:EDDiscovery,代码行数:34,代码来源:TabStyleCustom.cs

示例9: paintshit

 void paintshit(List<double> datta, int numPoints, double mulX, double mulY, int bw, int bh, Graphics g, LinearGradientBrush grad, Color cbase)
 {
     PointF[] points = new PointF[numPoints];
     lock (datta)
     {
         int s = 0;
         int samples = datta.Count;
         for (; s < (points.Length - 2) - samples; s++)
         {
             points[s + 1] = new PointF((float)(s * mulX), bh);
         }
         int ofs = (points.Length - 2) - samples;
         s = Math.Max(0, samples - (points.Length - 2));
         for (; s < samples; s++)
         {
             points[s + ofs + 1] = new PointF((float)((s + ofs) * mulX),
                 (float)(bh - datta[s] * mulY));
         }
         points[0] = new PointF(0f, bh);
         points[points.Length - 1] = new PointF(bw, bh);
     }
     GraphicsPath gp = new GraphicsPath();
     gp.AddLines(points);
     g.FillPath(grad, gp);
     g.DrawPath(new Pen(cbase, 2f), gp);
 }
开发者ID:9001,项目名称:Loopstream,代码行数:26,代码来源:UI_Graph.cs

示例10: DrawRoundRect

        /// <summary>
        /// 绘制圆角
        /// </summary>
        /// <param name="g"></param>
        /// <param name="p"></param>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="radius"></param>
        public static void DrawRoundRect(Graphics g, Pen p, Brush brush,float X, float Y, float width, float height, float radius)
        {
            System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();

            gp.AddLine(X + radius, Y, X + width - (radius * 2), Y);

            gp.AddArc(X + width - (radius * 2), Y, radius * 2, radius * 2, 270, 90);

            gp.AddLine(X + width, Y + radius, X + width, Y + height - (radius * 2));

            gp.AddArc(X + width - (radius * 2), Y + height - (radius * 2), radius * 2, radius * 2, 0, 90);

            gp.AddLine(X + width - (radius * 2), Y + height, X + radius, Y + height);

            gp.AddArc(X, Y + height - (radius * 2), radius * 2, radius * 2, 90, 90);

            gp.AddLine(X, Y + height - (radius * 2), X, Y + radius);

            gp.AddArc(X, Y, radius * 2, radius * 2, 180, 90);

            gp.CloseFigure();

            g.DrawPath(p, gp);

            g.FillPath(brush, gp);

            gp.Dispose();
        }
开发者ID:jyorin,项目名称:yinghe,代码行数:38,代码来源:绘图类.cs

示例11: Draw

        public override void Draw(Graphics g)
        {
            System.Drawing.Size st = g.MeasureString(Marker.ToolTipText, Font).ToSize();
             System.Drawing.Rectangle rect = new System.Drawing.Rectangle(Marker.ToolTipPosition.X, Marker.ToolTipPosition.Y - st.Height, st.Width + TextPadding.Width, st.Height + TextPadding.Height);
             rect.Offset(Offset.X, Offset.Y);

             using(GraphicsPath objGP = new GraphicsPath())
             {
            objGP.AddLine(rect.X + 2 * Radius, rect.Y + rect.Height, rect.X + Radius, rect.Y + rect.Height + Radius);
            objGP.AddLine(rect.X + Radius, rect.Y + rect.Height + Radius, rect.X + Radius, rect.Y + rect.Height);

            objGP.AddArc(rect.X, rect.Y + rect.Height - (Radius * 2), Radius * 2, Radius * 2, 90, 90);
            objGP.AddLine(rect.X, rect.Y + rect.Height - (Radius * 2), rect.X, rect.Y + Radius);
            objGP.AddArc(rect.X, rect.Y, Radius * 2, Radius * 2, 180, 90);
            objGP.AddLine(rect.X + Radius, rect.Y, rect.X + rect.Width - (Radius * 2), rect.Y);
            objGP.AddArc(rect.X + rect.Width - (Radius * 2), rect.Y, Radius * 2, Radius * 2, 270, 90);
            objGP.AddLine(rect.X + rect.Width, rect.Y + Radius, rect.X + rect.Width, rect.Y + rect.Height - (Radius * 2));
            objGP.AddArc(rect.X + rect.Width - (Radius * 2), rect.Y + rect.Height - (Radius * 2), Radius * 2, Radius * 2, 0, 90); // Corner

            objGP.CloseFigure();

            g.FillPath(Fill, objGP);
            g.DrawPath(Stroke, objGP);
             }

            #if !PocketPC
             g.DrawString(Marker.ToolTipText, Font, Brushes.Navy, rect, Format);
            #else
             g.DrawString(ToolTipText, ToolTipFont, TooltipForeground, rect, ToolTipFormat);
            #endif
        }
开发者ID:ravcio,项目名称:MapNet,代码行数:31,代码来源:GMapBaloonToolTip.cs

示例12: Show

			/// <summary>Draws the grip in the graphics context.</summary>
			/// <param name="g">Graphics context.</param>
			/// <param name="pageScale">Current zoom factor that can be used to calculate pen width etc. for displaying the handle. Attention: this factor must not be used to transform the path of the handle.</param>
			public void Show(Graphics g, double pageScale)
			{
				using (var pen = new Pen(Color.Blue, (float)(1 / pageScale)))
				{
					g.DrawPath(pen, _displayPath);
				}
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:10,代码来源:HitTestObject.cs

示例13: Draw

		public override void Draw(Graphics graphics)
		{
			if (graphics == null) {
				throw new ArgumentNullException("graphics");
			}
			
			Rectangle rect = new Rectangle(this.ClientRectangle.Left,this.ClientRectangle.Top,
			                               this.ClientRectangle.Right -1,
			                               this.ClientRectangle.Bottom -1);
//			backgroundShape.FillShape(graphics,
//			                new SolidFillPattern(this.BackColor),
//			                rect);
			
			Border b = new Border(new BaseLine (this.ForeColor,System.Drawing.Drawing2D.DashStyle.Solid,1));
//			DrawFrame(graphics,b);
			BaseLine line = new BaseLine(base.ForeColor,DashStyle,Thickness,LineCap.Round,LineCap.Round,DashCap.Round);
			using (Pen pen = line.CreatePen(line.Thickness)){
				shape.CornerRadius = this.CornerRadius;
				GraphicsPath path1 = shape.CreatePath(rect);
				graphics.DrawPath(pen, path1);
				
			}
			
//			shape.DrawShape (graphics,
//			                 this.Baseline(),
//			                 rect);
			
		}
开发者ID:Rpinski,项目名称:SharpDevelop,代码行数:28,代码来源:BaseRectangleItem.cs

示例14: DrawRoundRect

        public void DrawRoundRect(Graphics g, Pen p, float X, float Y, float width, float height, float radius)
        {
            try
            {
                p.Width = 6;
                Rectangle r = this.ClientRectangle;
                // r.Width--; r.Height--;
                using (GraphicsPath rr = RoundRect(r, CornerRadius, CornerRadius, CornerRadius, CornerRadius))
                {
                    using (System.Drawing.Drawing2D.LinearGradientBrush gradBrush = new System.Drawing.Drawing2D.LinearGradientBrush(this.ClientRectangle, Color.Black, Color.Black, 90, false))
                    {

                        ColorBlend cb = new ColorBlend();
                        cb.Positions = new[] { 0, 1f };
                        cb.Colors = new[] { Color.Transparent, Color.Transparent };
                        gradBrush.InterpolationColors = cb;
                        // rotate
                        gradBrush.RotateTransform(0);
                        // paint
                        //g.FillPath(gradBrush, rr);
                        g.DrawPath(p, rr);
                    }
                }
            }
            catch (Exception Ex)
            {
                MessageBox.Show(Ex.Message);
            }
        }
开发者ID:antonesterhuyse,项目名称:GrucoxScrumView,代码行数:29,代码来源:RoundedPamel.cs

示例15: Draw

 public override void Draw(Graphics g, RectangleD worldRect, Rectangle canvasRect)
 {
     base.Draw(g, worldRect, canvasRect);
     var pen = new Pen(UpLineColor, LineWidth);
     var path = new GraphicsPath();
     pen.DashStyle = (DashStyle)Enum.Parse(typeof(DashStyle), LineStyle.ToString());
     using (pen)
     {
         using (path)
         {
             for (int i = 1; i < Data.Count; i++)
             {
                 GetPriceByField(i);
                 var tf =
                     (PointF)
                     Conversion.WorldToScreen(
                         new PointD(i - 1, GetPriceByField(i - 1)), worldRect,
                         canvasRect);
                 var tf2 =
                     (PointF)
                     Conversion.WorldToScreen(new PointD(i, GetPriceByField(i)), worldRect,
                                              canvasRect);
                 path.AddLine(tf, tf2);
             }
             g.DrawPath(pen, path);
         }
     }
 }
开发者ID:johnmensen,项目名称:TradeSharp,代码行数:28,代码来源:StockLineSeries.cs


注:本文中的System.Drawing.Graphics.DrawPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。