本文整理汇总了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));
}
}
示例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);
}
}
}