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


C# System.Drawing.Drawing2D.GraphicsPath.AddClosedCurve方法代码示例

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


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

示例1: panel1_Paint

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            if (COG == null)
            {
                foreach (PointF pt in pts.ToArray())
                   g.FillRectangle(Brushes.Black, new RectangleF(pt.X - 2, pt.Y - 2, 4, 4));
            }
            else
            {
                System.Drawing.Drawing2D.GraphicsPath Path = new System.Drawing.Drawing2D.GraphicsPath();
                Path.AddClosedCurve((PointF[])pts.ToArray(),float.Parse(text_objTension.Text));
                g.DrawPath(Pens.Black, Path);

                g.FillEllipse(Brushes.Red, new RectangleF(COG.Value.X - 2, COG.Value.Y - 2, 4, 4));
                g.FillEllipse(Brushes.Blue, new RectangleF(Desc.Centroid.X - 2, Desc.Centroid.Y - 2, 4, 4));
            }
        }
开发者ID:NumberFour8,项目名称:PhysBox,代码行数:18,代码来源:CreateObject.cs

示例2: mInkPicture_NewPackets

        void mInkPicture_NewPackets(object sender, InkCollectorNewPacketsEventArgs e)
        {
            //Console.WriteLine("mInkPicture_NewPackets PacketCount={0}", e.PacketCount);
            //if (this.DialogResult != System.Windows.Forms.DialogResult.None) return;
            if (dlgRes != System.Windows.Forms.DialogResult.None) return;

            float[] intersections = e.Stroke.SelfIntersections;
            if (intersections.Length > 0)
            {
                String msg = "SelfIntersections=";
                foreach (float f in intersections)
                {
                    msg += f + " ";
                }
                Console.WriteLine(msg);

                try
                {
                    int ipt1 = (int)Math.Round(intersections[0], 0);
                    int ipt2 = (int)Math.Round(intersections[intersections.Length - 1], 0);
                    int count = ipt2 - ipt1;
                    Point[] pts = e.Stroke.GetPoints();
                    Point[] ptPath = new Point[count];
                    //Graphics g = Graphics.FromImage(mBgBmp);
                    Graphics g = mInkPicture.CreateGraphics();
                    mInkPicture.Renderer.InkSpaceToPixel(g, ref pts);
                    Array.Copy(pts, ipt1, ptPath, 0, count);
                    Pen p = new Pen(Color.Red);
                    g.DrawPolygon(p, ptPath);

                    dlgRes = MessageBox.Show("Clip and Copy this region?", "Selection", MessageBoxButtons.YesNoCancel);
                    if (dlgRes == System.Windows.Forms.DialogResult.Yes)
                    {
                        System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                        path.AddClosedCurve(ptPath);
                        if (mSelRegion != null) mSelRegion.Dispose();
                        mSelRegion = new Region(path);
                        mRegionPath = ptPath;
                    }
                    g.Dispose();

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.WriteLine(ex.StackTrace);
                }
            }
        }
开发者ID:stndstn,项目名称:InkNote,代码行数:49,代码来源:FormSelRegion.cs


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