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


C# GraphicsPath.AddArc方法代码示例

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


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

示例1: MainForm_Paint

	void MainForm_Paint (object sender, PaintEventArgs e)
	{
		Graphics g = e.Graphics;
		GraphicsPath path = new GraphicsPath ();

		Rectangle borderect = new Rectangle (49, 49, 252, 252);
		g.FillRectangle (new SolidBrush (Color.White), borderect);

		int Diameter = 16;
		Rectangle baserect = new Rectangle (50, 50, 249, 249);

		Rectangle arcrect = new Rectangle (baserect.Location, new Size (Diameter, Diameter));

		// handle top left corner
		path.AddArc (arcrect, 180, 90);

		// handle top right corner
		arcrect.X = baserect.Right - Diameter;
		path.AddArc (arcrect, 270, 90);

		// handle baserect right corner
		arcrect.Y = baserect.Bottom - Diameter;
		path.AddArc (arcrect, 0, 90);

		// handle bottom left corner
		arcrect.X = baserect.Left;
		path.AddArc (arcrect, 90, 90);

		path.CloseFigure ();

		g.DrawPath (Pens.SteelBlue, path);
	}
开发者ID:mono,项目名称:gert,代码行数:32,代码来源:MainForm.cs

示例2: CreateRound

 static internal GraphicsPath CreateRound(Rectangle r, int slope)
 {
     CreateRoundPath = new GraphicsPath(FillMode.Winding);
     CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180f, 90f);
     CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270f, 90f);
     CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0f, 90f);
     CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90f, 90f);
     CreateRoundPath.CloseFigure();
     return CreateRoundPath;
 }
开发者ID:massimoca,项目名称:Wedit,代码行数:10,代码来源:Theme.cs

示例3: RoundRect

 public static GraphicsPath RoundRect(Rectangle rect, int Curve)
 {
     GraphicsPath P = new GraphicsPath();
     int ArcRectWidth = Curve * 2;
     P.AddArc(new Rectangle(rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -180, 90);
     P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Y, ArcRectWidth, ArcRectWidth), -90, 90);
     P.AddArc(new Rectangle(rect.Width - ArcRectWidth + rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 0, 90);
     P.AddArc(new Rectangle(rect.X, rect.Height - ArcRectWidth + rect.Y, ArcRectWidth, ArcRectWidth), 90, 90);
     P.AddLine(new Point(rect.X, rect.Height - ArcRectWidth + rect.Y), new Point(rect.X, Curve + rect.Y));
     return P;
 }
开发者ID:MrAdder,项目名称:Launcher_Arma3,代码行数:11,代码来源:Theme_Perplex.cs

示例4: OnResize

    protected override void OnResize(EventArgs e)
    {
        Height = 19; Width = 47;
        
        RoundedRectangle = new GraphicsPath();
        int radius = 10;

        RoundedRectangle.AddArc(11, 4, radius - 1, radius, 180, 90);
        RoundedRectangle.AddArc(Width - 21, 4, radius - 1, radius, -90, 90);
        RoundedRectangle.AddArc(Width - 21, Height - 15, radius - 1, radius, 0, 90);
        RoundedRectangle.AddArc(11, Height - 15, radius - 1, radius, 90, 90);

        RoundedRectangle.CloseAllFigures();
        Invalidate(); 
    }
开发者ID:mr-amini,项目名称:ComU,代码行数:15,代码来源:LollipopToggle.cs

示例5: CreateRoundRect

    public static GraphicsPath CreateRoundRect(float x, float y, float width, float height, float radius)
    {
        GraphicsPath gp = new 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();
        return gp;
    }
开发者ID:mr-amini,项目名称:ComU,代码行数:18,代码来源:DrawHelper.cs

示例6: MainForm_Load

	void MainForm_Load (object sender, EventArgs e)
	{
		GraphicsPath gp = new GraphicsPath ();
		gp.AddArc (_changeShapeButton.ClientRectangle, 0.0f, 360.0f);
		_changeShapeButton.Region = new Region (gp);

		InstructionsForm instructionsForm = new InstructionsForm ();
		instructionsForm.Show ();
	}
开发者ID:mono,项目名称:gert,代码行数:9,代码来源:MainForm.cs

示例7: CreateRoundedRectangle

    public static GraphicsPath CreateRoundedRectangle(SizeF size, PointF location)
    {
        int cornerSize			= (int)GraphConstants.CornerSize * 2;

        var height				= size.Height;
        var width				= size.Width;
        var left				= location.X;
        var top					= location.Y;
        var right				= location.X + width;
        var bottom				= location.Y + height;

        var path = new GraphicsPath(FillMode.Winding);
        path.AddArc(left, top, cornerSize, cornerSize, 180, 90);
        path.AddArc(right - cornerSize, top, cornerSize, cornerSize, 270, 90);

        path.AddArc(right - cornerSize, bottom - cornerSize, cornerSize, cornerSize, 0, 90);
        path.AddArc(left, bottom - cornerSize, cornerSize, cornerSize, 90, 90);
        path.CloseFigure();
        return path;
    }
开发者ID:idursun,项目名称:StateMachines,代码行数:20,代码来源:GraphUtils.cs

示例8: MakeRoundedCorners

    private static Image MakeRoundedCorners(Image image, int radius)
    {
        Bitmap bmp = new Bitmap(image, image.Width, image.Height);
        using (Graphics g = Graphics.FromImage(bmp))
        {
            Brush brush = new SolidBrush(Color.White);

            for (int i = 0; i < 4; i++)
            {
                Point[] cornerUpLeft = new Point[3];

                cornerUpLeft[0].X = 0;
                cornerUpLeft[0].Y = 0;

                cornerUpLeft[1].X = radius;
                cornerUpLeft[1].Y = 0;

                cornerUpLeft[2].X = 0;
                cornerUpLeft[2].Y = radius;

                GraphicsPath pathCornerUpLeft = new GraphicsPath();

                pathCornerUpLeft.AddArc(cornerUpLeft[0].X, cornerUpLeft[0].Y,
                                        radius, radius, 180, 90);
                pathCornerUpLeft.AddLine(cornerUpLeft[0].X, cornerUpLeft[0].Y,
                                         cornerUpLeft[1].X, cornerUpLeft[1].Y);
                pathCornerUpLeft.AddLine(cornerUpLeft[0].X, cornerUpLeft[0].Y,
                                         cornerUpLeft[2].X, cornerUpLeft[2].Y);

                g.FillPath(brush, pathCornerUpLeft);
                pathCornerUpLeft.Dispose();

                bmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
            }

            brush.Dispose();
            g.Dispose();
        }
        return bmp;
    }
开发者ID:sedogo,项目名称:site,代码行数:40,代码来源:ImageHelper.cs

示例9: CreateRoundedRectangleRegion

            private Region CreateRoundedRectangleRegion(int radius, Rectangle rectangle)
            {
                using (GraphicsPath Path = new GraphicsPath())
                {
                    int Radius2 = (radius * 2);

                    Path.FillMode = FillMode.Winding;

                    Path.StartFigure();
                    Path.AddArc(rectangle.X, rectangle.Y, Radius2, Radius2, 180, 90);
                    Path.AddLine(rectangle.X + radius, rectangle.Y, rectangle.Right - radius, rectangle.Y);
                    Path.AddArc(rectangle.Right - Radius2 - 1, rectangle.Y, Radius2, Radius2, 270, 90);
                    Path.AddLine(rectangle.Right, rectangle.Y + radius, rectangle.Right, rectangle.Bottom - radius);
                    Path.AddArc(rectangle.Right - Radius2 - 1, rectangle.Bottom - Radius2 - 1, Radius2, Radius2, 0, 90);
                    Path.AddLine(rectangle.Right - radius, rectangle.Bottom, rectangle.X + radius, rectangle.Bottom);
                    Path.AddArc(rectangle.X, rectangle.Bottom - Radius2 - 1, Radius2, Radius2, 90, 90);
                    Path.AddLine(rectangle.X, rectangle.Bottom - radius, rectangle.X, rectangle.Y + radius);
                    Path.CloseFigure();

                    return new Region(Path);
                }
            }
开发者ID:ArchangelNexus,项目名称:Abstract-Design-Utility,代码行数:22,代码来源:BorderlessWindow.cs

示例10: GetPath

	protected GraphicsPath GetPath()
	{
		GraphicsPath graphPath = new GraphicsPath();

		if (_BorderStyle == BorderStyle.Fixed3D)
		{
			graphPath.AddRectangle(ClientRectangle);
		}
		else
		{
			try
			{
				int curve = 0;

				Rectangle rect = ClientRectangle;
				int offset = 0;

				switch (_BorderStyle)
				{
				case BorderStyle.FixedSingle:
					offset = (int) Math.Ceiling(BorderWidth / 2.0d);
					curve = adjustedCurve;

					break;
				case BorderStyle.Fixed3D:

					break;
				case BorderStyle.None:
					curve = adjustedCurve;

					break;
				}

				if (curve == 0)
				{
					graphPath.AddRectangle(Rectangle.Inflate(rect, -offset, -offset));
				}
				else
				{
					int rectWidth = rect.Width - 1 - offset;
					int rectHeight = rect.Height - 1 - offset;
					int curveWidth;

					if ((_CurveMode & CornerCurveMode.TopRight) != 0)
					{
						curveWidth = (curve * 2);
					}
					else
					{
						curveWidth = 1;
					}
					graphPath.AddArc(rectWidth - curveWidth, offset, curveWidth, curveWidth, 270, 90);

					if ((_CurveMode & CornerCurveMode.BottomRight) != 0)
					{
						curveWidth = (curve * 2);
					}
					else
					{
						curveWidth = 1;
					}
					graphPath.AddArc(rectWidth - curveWidth, rectHeight - curveWidth, curveWidth, curveWidth, 0, 90);

					if ((_CurveMode & CornerCurveMode.BottomLeft) != 0)
					{
						curveWidth = (curve * 2);
					}
					else
					{
						curveWidth = 1;
					}
					graphPath.AddArc(offset, rectHeight - curveWidth, curveWidth, curveWidth, 90, 90);

					if ((_CurveMode & CornerCurveMode.TopLeft) != 0)
					{
						curveWidth = (curve * 2);
					}
					else
					{
						curveWidth = 1;
					}
					graphPath.AddArc(offset, offset, curveWidth, curveWidth, 180, 90);

					graphPath.CloseFigure();
				}
			}
			catch (Exception)
			{
				graphPath.AddRectangle(ClientRectangle);
			}
		}

		return graphPath;
	}
开发者ID:killbug2004,项目名称:WSProf,代码行数:94,代码来源:CustomPanel.cs

示例11: GetValueRec

 public GraphicsPath GetValueRec()
 {
     GraphicsPath gp = new GraphicsPath();
     gp.AddArc((float)((.05f) * vm.Width), (float)((1f / 3f) * vm.Height), (float)(.90f) * vm.Width, (float)(1.2f) * vm.Height, -180f, 180f);
     gp.AddLine((float)((.05f) * vm.Width), (float)((70f / 75f) * vm.Height), (float)(.95f) * vm.Width, (float)((70f / 75f) * vm.Height));
     return gp;
 }
开发者ID:byteit101,项目名称:ZomB-Dashboard-System,代码行数:7,代码来源:AnalogMeter.cs

示例12: CreateRoundRect

 internal GraphicsPath CreateRoundRect(Rectangle r, int curve)
 {
     // Draw a border radius
     try
     {
         CreateRoundPath = new GraphicsPath(FillMode.Winding);
         CreateRoundPath.AddArc(r.X, r.Y, curve, curve, 180f, 90f);
         CreateRoundPath.AddArc(r.Right - curve, r.Y, curve, curve, 270f, 90f);
         CreateRoundPath.AddArc(r.Right - curve, r.Bottom - curve, curve, curve, 0f, 90f);
         CreateRoundPath.AddArc(r.X, r.Bottom - curve, curve, curve, 90f, 90f);
         CreateRoundPath.CloseFigure();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + Environment.NewLine + Environment.NewLine + "Value must be either '1' or higher", "Invalid Integer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         // Return to the default border curve if the parameter is less than "1"
         _BorderCurve = 8;
         BorderCurve = 8;
     }
     return CreateRoundPath;
 }
开发者ID:Hli4S,项目名称:TestMeApp,代码行数:21,代码来源:NotificationBox.cs

示例13: CreateRoundRectPath

    /// <summary>
    /// Creates the round rect path.
    /// </summary>
    /// <param name="rect">The rectangle on which graphics path will be spanned.</param>
    /// <param name="size">The size of rounded rectangle edges.</param>
    /// <returns></returns>
    public static GraphicsPath CreateRoundRectPath(Rectangle rect, Size size)
    {
        GraphicsPath gp = new GraphicsPath();
        gp.AddLine(rect.Left + size.Width / 2, rect.Top, rect.Right - size.Width / 2, rect.Top);
        gp.AddArc(rect.Right - size.Width, rect.Top, size.Width, size.Height, 270, 90);

        gp.AddLine(rect.Right, rect.Top + size.Height / 2, rect.Right, rect.Bottom - size.Width / 2);
        gp.AddArc(rect.Right - size.Width, rect.Bottom - size.Height, size.Width, size.Height, 0, 90);

        gp.AddLine(rect.Right - size.Width / 2, rect.Bottom, rect.Left + size.Width / 2, rect.Bottom);
        gp.AddArc(rect.Left, rect.Bottom - size.Height, size.Width, size.Height, 90, 90);

        gp.AddLine(rect.Left, rect.Bottom - size.Height / 2, rect.Left, rect.Top + size.Height / 2);
        gp.AddArc(rect.Left, rect.Top, size.Width, size.Height, 180, 90);
        return gp;
    }
开发者ID:philwo,项目名称:crossfade,代码行数:22,代码来源:ToolStripSlider.cs

示例14: RoundRectangle

    private GraphicsPath RoundRectangle(Rectangle r, int radius, GroupBoxCorners corners)
    {
        GraphicsPath path = new GraphicsPath();
        if (r.Width <= 0 | r.Height <= 0)
          return path;

        int d = radius * 2;

        int nw = ((corners & GroupBoxCorners.NorthWest) == GroupBoxCorners.NorthWest ? d : 0);
        int ne = ((corners & GroupBoxCorners.NorthEast) == GroupBoxCorners.NorthEast ? d : 0);
        int se = ((corners & GroupBoxCorners.SouthEast) == GroupBoxCorners.SouthEast ? d : 0);
        int sw = ((corners & GroupBoxCorners.SouthWest) == GroupBoxCorners.SouthWest ? d : 0);

        path.AddLine(r.Left + nw, r.Top, r.Right - ne, r.Top);

        if (ne > 0)
        {
          path.AddArc(Rectangle.FromLTRB(r.Right - ne, r.Top, r.Right, r.Top + ne), -90, 90);
        }

        path.AddLine(r.Right, r.Top + ne, r.Right, r.Bottom - se);

        if (se > 0)
        {
          path.AddArc(Rectangle.FromLTRB(r.Right - se, r.Bottom - se, r.Right, r.Bottom), 0, 90);
        }

        path.AddLine(r.Right - se, r.Bottom, r.Left + sw, r.Bottom);

        if (sw > 0)
        {
          path.AddArc(Rectangle.FromLTRB(r.Left, r.Bottom - sw, r.Left + sw, r.Bottom), 90, 90);
        }

        path.AddLine(r.Left, r.Bottom - sw, r.Left, r.Top + nw);

        if (nw > 0)
        {
          path.AddArc(Rectangle.FromLTRB(r.Left, r.Top, r.Left + nw, r.Top + nw), 180, 90);
        }

        path.CloseFigure();
        return path;
    }
开发者ID:Cycli,项目名称:Cycli,代码行数:44,代码来源:RoundedGroupBox.cs

示例15: RoundRect

 public GraphicsPath RoundRect(Rectangle Rectangle, int Curve)
 {
     GraphicsPath P = new GraphicsPath();
     int ArcRectangleWidth = Curve * 2;
     P.AddArc(new Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90);
     P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90);
     P.AddArc(new Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90);
     P.AddArc(new Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90);
     P.AddLine(new Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), new Point(Rectangle.X, Curve + Rectangle.Y));
     return P;
 }
开发者ID:banksyhf,项目名称:Auxilium,代码行数:11,代码来源:Controls.cs


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