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


C# IGraphicsContext.DrawPath方法代码示例

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


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

示例1: Render

        public void Render(IGraphicsContext context)
        {
            Frame = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
            var rectBackground = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
            context.DrawRectangle(rectBackground, _brushBackground, _penTransparent);

            if (_isIndeterminate)
            {
                var rectForeground = new BasicRectangle(0, 0, context.BoundsWidth, context.BoundsHeight);
                context.DrawRectangle(rectForeground, _brushForeground, _penTransparent);

                const int pixelsPerIteration = 1;
                float inclination = 15 * context.Density;
                float barSize = 20 * context.Density;
                float widthBetweenBars = 0;//2 * context.Density;
                float totalBarWidth = barSize + inclination + widthBetweenBars;
                int barCount = (int)Math.Ceiling(context.BoundsWidth / totalBarWidth);
                for (int a = -1; a < barCount + 1; a++) // bleed paths out of bounds partially visible
                {
                    float offset = (_animationCounter % totalBarWidth) * pixelsPerIteration;
                    float x = (a * totalBarWidth) + offset;
                    var path = new BasicPath();
                    path.AddLine(new BasicPathLine(new BasicPoint(x, context.BoundsHeight), new BasicPoint(x + barSize, context.BoundsHeight)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + barSize, context.BoundsHeight), new BasicPoint(x + barSize + inclination, 0)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + barSize + inclination, 0), new BasicPoint(x + inclination, 0)));
                    path.AddLine(new BasicPathLine(new BasicPoint(x + inclination, 0), new BasicPoint(x, context.BoundsHeight)));
                    context.DrawPath(path, _brushIndeterminateForeground, _penTransparent);
                }
            } 
            else
            {
                var rectForeground = new BasicRectangle(0, 0, _value * context.BoundsWidth, context.BoundsHeight);
                context.DrawRectangle(rectForeground, _brushForeground, _penTransparent);
            }
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:35,代码来源:ProgressBarControl.cs

示例2: DrawComponent

		protected void DrawComponent (IGraphicsContext g, int x_left, int y_top, int width, int height, int radius, int thickness, Color color)
		{
			GraphicsPath path = new GraphicsPath ();
			path.StartFigure ();
			path.AddRectangle (Bounds);
			if (Selected)
			{
				path.AddLine (x_left + 5 + thickness, y_top + height / 2, x_left + 5 + thickness, y_top + radius);
				path.AddLine (x_left + 5 + thickness, y_top + 5 + thickness, x_left + 5 + thickness + width / 2, y_top + 5 + thickness);
				path.AddLine (x_left + 5 + thickness + width / 2, y_top + 5 + thickness, x_left + 5 + thickness, y_top + 5 + thickness);
			}
			path.CloseFigure ();

			using (Brush brush = new System.Drawing.SolidBrush (color))
			{
				using (Pen pen = new Pen (brush, thickness))
				{
					g.DrawPath (pen, path);
					if (Name != null && Name.Trim () != "")
					{
						g.DrawString (Name, brush, radius, new Point (x_left + radius, y_top + 1), false);
					}
				}
			}
		}
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:25,代码来源:OperationGlyph.cs

示例3: DrawState

        protected void DrawState(IGraphicsContext g, int x_left, int y_top, int width, int height, int radius, int thickness, Color color, bool drawTestRect)
        {
            if (drawTestRect)
            {
                GraphicsPath path = new GraphicsPath ();
                Rectangle rect = new Rectangle (x_left, y_top, width, height);
                path.AddRectangle (rect);
                path.CloseFigure ();

                using (Brush brush = new System.Drawing.SolidBrush (Color.Yellow))
                {
                    using (Pen pen = new Pen (brush, thickness))
                    {
                        g.DrawPath (pen, path);
                    }
                }
            }

            if (true)
            {
                GraphicsPath path = new GraphicsPath ();
                path.StartFigure ();
                path.AddArc (x_left, y_top, radius, radius, 180, 90);
                if (IsStartState)
                {
                    path.AddLine (x_left + radius, y_top, x_left, y_top + radius);
                }
                path.AddLine (x_left + radius, y_top, x_left + width - radius - radius, y_top);
                path.AddArc (x_left + width - radius, y_top, radius, radius, 270, 90);
                path.AddLine (x_left + width, y_top + radius, x_left + width, y_top + height - radius - radius);
                path.AddArc (x_left + width - radius, y_top + height - radius, radius, radius, 0, 90);
                path.AddLine (x_left + width - radius, y_top + height, x_left + radius, y_top + height);
                path.AddArc (x_left, y_top + height - radius, radius, radius, 90, 90);
                path.AddLine (x_left, y_top + height - radius, x_left, y_top + radius);
                if (Selected)
                {
                    path.AddLine (x_left + 5 + thickness, y_top + radius, x_left + 5 + thickness, y_top + height / 2);
                    path.AddLine (x_left + 5 + thickness, y_top + height / 2, x_left + 5 + thickness, y_top + radius);
                }
                path.CloseFigure ();
                if (IsFinalState)
                {
                    path.StartFigure ();
                    path.AddLine (x_left +width - radius, y_top + height, x_left + width, y_top + height - radius);
                    path.CloseFigure ();
                }

                using (Brush brush = new System.Drawing.SolidBrush (color))
                {
                    using (Pen pen = new Pen (brush, thickness))
                    {
                        g.DrawPath (pen, path);

                        if (IsNotEmptyString (Name))
                        {
                            DrawString (g, Name, brush, (int) ((radius * 2.0) / 3.0), new Point (x_left + radius, y_top + 1), FontStyle.Bold);
                        }
                        int ypos = y_top + 1 + radius + radius / 2;
                        if (IsNotEmptyString (EntryAction))
                        {
                            DrawString (g, "e:" + EntryAction, brush, radius / 2, new Point (x_left + radius, ypos), FontStyle.Regular);
                            ypos += (radius + radius) / 3;
                        }
                        if (IsNotEmptyString (ExitAction))
                        {
                            DrawString (g, "x:" + ExitAction, brush, radius / 2, new Point (x_left + radius, ypos), FontStyle.Regular);
                            ypos += (radius + radius) / 3;
                        }
                        if (IsNotEmptyString (DoAction))
                        {
                            DrawString (g, "a:" + DoAction, brush, radius / 2, new Point (x_left + radius, ypos), FontStyle.Regular);
                        }
                    }
                }

            }
        }
开发者ID:poobalan-arumugam,项目名称:stateproto,代码行数:77,代码来源:StateGlyph.cs


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