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


C# Pen.Dispose方法代码示例

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


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

示例1: EllipseAndCurveTest

		static void EllipseAndCurveTest(Graphics graphics)
		{
			var path = new GraphicsPath();
			path.FillMode = FillMode.Winding;
			path.AddBezier(new PointF(10f, 6f), new PointF(10f, 4f), new PointF(8f, 2f), new PointF(6f, 2f));
			path.CloseFigure();
			var m = Matrix.Create();
			m.Scale(60f, 60f);
			graphics.SaveTransform();
			graphics.MultiplyTransform(m);
			var brush = new SolidBrush(Colors.Black);
			var pen = new Pen(Colors.Red, 0.1f);
			graphics.FillPath(brush, path);
			graphics.DrawPath(pen, path);
			brush.Dispose();
			pen.Dispose();
			var brushY = new SolidBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0x9F));
			var penB = new Pen(Color.FromArgb(0x00, 0x00, 0xFF, 0x9F), 0.1f);
			graphics.DrawEllipse(penB, 10f, 6f, 0.5f, 0.5f);
			graphics.FillEllipse(brushY, 10f, 6f, 0.5f, 0.5f);
			graphics.DrawEllipse(penB, 6f, 2f, 0.5f, 0.5f);
			graphics.FillEllipse(brushY, 6f, 2f, 0.5f, 0.5f);
			graphics.RestoreTransform();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:24,代码来源:PixelOffsetTransforms.cs

示例2: ScissorsTest


//.........这里部分代码省略.........
			path.FillMode = FillMode.Winding;
			// draw some scissors
			path.AddBezier(new PointF(9.64f, 7.64f), new PointF(9.87f, 7.14f), new PointF(10f, 6.59f), new PointF(10f, 6f));
			path.AddBezier(new PointF(10f, 6f), new PointF(10f, 3.79f), new PointF(8.21f, 2f), new PointF(6f, 2f));
			path.AddBezier(new PointF(6f, 2f), new PointF(3.79f, 2f), new PointF(2f, 3.79f), new PointF(2f, 6f));
			path.AddBezier(new PointF(2f, 6f), new PointF(2f, 8.21f), new PointF(3.79f, 10f), new PointF(6f, 10f));
			path.AddBezier(new PointF(6f, 10f), new PointF(6.59f, 10f), new PointF(7.14f, 9.87f), new PointF(7.64f, 9.64f));
			path.AddLine(7.64f, 9.64f, 10f, 12f);
			path.AddLine(10f, 12f, 7.64f, 14.36f);
			path.AddBezier(new PointF(7.64f, 14.36f), new PointF(7.14f, 14.13f), new PointF(6.59f, 14f), new PointF(6f, 14f));
			path.AddBezier(new PointF(6f, 14f), new PointF(3.79f, 14f), new PointF(2f, 15.79f), new PointF(2f, 18f));
			path.AddBezier(new PointF(2f, 18f), new PointF(2f, 20.21f), new PointF(3.79f, 22f), new PointF(6f, 22f));
			path.AddBezier(new PointF(6f, 22f), new PointF(8.21f, 22f), new PointF(10f, 20.21f), new PointF(10f, 18f));
			path.AddBezier(new PointF(10f, 18f), new PointF(10f, 17.41f), new PointF(9.87f, 16.86f), new PointF(9.64f, 16.36f));
			path.AddLine(9.64f, 16.36f, 12f, 14f);
			path.AddLine(12f, 14f, 19f, 21f);
			path.AddLine(19f, 21f, 22f, 21f);
			path.AddLine(22f, 21f, 22f, 20f);
			path.AddLine(22f, 20f, 9.64f, 7.64f);
			path.CloseFigure();
			path.AddBezier(new PointF(6f, 8f), new PointF(4.9f, 8f), new PointF(4f, 7.11f), new PointF(4f, 6f));
			path.AddBezier(new PointF(4f, 6f), new PointF(4f, 4.89f), new PointF(4.9f, 4f), new PointF(6f, 4f));
			path.AddBezier(new PointF(6f, 4f), new PointF(7.1f, 4f), new PointF(8f, 4.89f), new PointF(8f, 6f));
			path.AddBezier(new PointF(8f, 6f), new PointF(8f, 7.11f), new PointF(7.1f, 8f), new PointF(6f, 8f));
			path.CloseFigure();
			path.AddBezier(new PointF(6f, 20f), new PointF(4.9f, 20f), new PointF(4f, 19.11f), new PointF(4f, 18f));
			path.AddBezier(new PointF(4f, 18f), new PointF(4f, 16.89f), new PointF(4.9f, 16f), new PointF(6f, 16f));
			path.AddBezier(new PointF(6f, 16f), new PointF(7.1f, 16f), new PointF(8f, 16.89f), new PointF(8f, 18f));
			path.AddBezier(new PointF(8f, 18f), new PointF(8f, 19.11f), new PointF(7.1f, 20f), new PointF(6f, 20f));
			path.CloseFigure();
			path.AddBezier(new PointF(12f, 12.5f), new PointF(11.72f, 12.5f), new PointF(11.5f, 12.28f), new PointF(11.5f, 12f));
			path.AddBezier(new PointF(11.5f, 12f), new PointF(11.5f, 11.72f), new PointF(11.72f, 11.5f), new PointF(12f, 11.5f));
			path.AddBezier(new PointF(12f, 11.5f), new PointF(12.28f, 11.5f), new PointF(12.5f, 11.72f), new PointF(12.5f, 12f));
			path.AddBezier(new PointF(12.5f, 12f), new PointF(12.5f, 12.28f), new PointF(12.28f, 12.5f), new PointF(12f, 12.5f));
			path.CloseFigure();
			path.AddLine(19f, 3f, 13f, 9f);
			path.AddLine(13f, 9f, 15f, 11f);
			path.AddLine(15f, 11f, 22f, 4f);
			path.AddLine(22f, 4f, 22f, 3f);
			path.CloseFigure();
			path.AddBezier(new PointF(9.64f, 7.64f), new PointF(9.87f, 7.14f), new PointF(10f, 6.59f), new PointF(10f, 6f));
			path.AddBezier(new PointF(10f, 6f), new PointF(10f, 3.79f), new PointF(8.21f, 2f), new PointF(6f, 2f));
			path.AddBezier(new PointF(6f, 2f), new PointF(3.79f, 2f), new PointF(2f, 3.79f), new PointF(2f, 6f));
			path.AddBezier(new PointF(2f, 6f), new PointF(2f, 8.21f), new PointF(3.79f, 10f), new PointF(6f, 10f));
			path.AddBezier(new PointF(6f, 10f), new PointF(6.59f, 10f), new PointF(7.14f, 9.87f), new PointF(7.64f, 9.64f));
			path.AddLine(7.64f, 9.64f, 10f, 12f);
			path.AddLine(10f, 12f, 7.64f, 14.36f);
			path.AddBezier(new PointF(7.64f, 14.36f), new PointF(7.14f, 14.13f), new PointF(6.59f, 14f), new PointF(6f, 14f));
			path.AddBezier(new PointF(6f, 14f), new PointF(3.79f, 14f), new PointF(2f, 15.79f), new PointF(2f, 18f));
			path.AddBezier(new PointF(2f, 18f), new PointF(2f, 20.21f), new PointF(3.79f, 22f), new PointF(6f, 22f));
			path.AddBezier(new PointF(6f, 22f), new PointF(8.21f, 22f), new PointF(10f, 20.21f), new PointF(10f, 18f));
			path.AddBezier(new PointF(10f, 18f), new PointF(10f, 17.41f), new PointF(9.87f, 16.86f), new PointF(9.64f, 16.36f));
			path.AddLine(9.64f, 16.36f, 12f, 14f);
			path.AddLine(12f, 14f, 19f, 21f);
			path.AddLine(19f, 21f, 22f, 21f);
			path.AddLine(22f, 21f, 22f, 20f);
			path.AddLine(22f, 20f, 9.64f, 7.64f);
			path.CloseFigure();
			path.AddBezier(new PointF(6f, 8f), new PointF(4.9f, 8f), new PointF(4f, 7.11f), new PointF(4f, 6f));
			path.AddBezier(new PointF(4f, 6f), new PointF(4f, 4.89f), new PointF(4.9f, 4f), new PointF(6f, 4f));
			path.AddBezier(new PointF(6f, 4f), new PointF(7.1f, 4f), new PointF(8f, 4.89f), new PointF(8f, 6f));
			path.AddBezier(new PointF(8f, 6f), new PointF(8f, 7.11f), new PointF(7.1f, 8f), new PointF(6f, 8f));
			path.CloseFigure();
			path.AddBezier(new PointF(6f, 20f), new PointF(4.9f, 20f), new PointF(4f, 19.11f), new PointF(4f, 18f));
			path.AddBezier(new PointF(4f, 18f), new PointF(4f, 16.89f), new PointF(4.9f, 16f), new PointF(6f, 16f));
			path.AddBezier(new PointF(6f, 16f), new PointF(7.1f, 16f), new PointF(8f, 16.89f), new PointF(8f, 18f));
			path.AddBezier(new PointF(8f, 18f), new PointF(8f, 19.11f), new PointF(7.1f, 20f), new PointF(6f, 20f));
			path.CloseFigure();
			path.AddBezier(new PointF(12f, 12.5f), new PointF(11.72f, 12.5f), new PointF(11.5f, 12.28f), new PointF(11.5f, 12f));
			path.AddBezier(new PointF(11.5f, 12f), new PointF(11.5f, 11.72f), new PointF(11.72f, 11.5f), new PointF(12f, 11.5f));
			path.AddBezier(new PointF(12f, 11.5f), new PointF(12.28f, 11.5f), new PointF(12.5f, 11.72f), new PointF(12.5f, 12f));
			path.AddBezier(new PointF(12.5f, 12f), new PointF(12.5f, 12.28f), new PointF(12.28f, 12.5f), new PointF(12f, 12.5f));
			path.CloseFigure();
			path.AddLine(19f, 3f, 13f, 9f);
			path.AddLine(13f, 9f, 15f, 11f);
			path.AddLine(15f, 11f, 22f, 4f);
			path.AddLine(22f, 4f, 22f, 3f);
			path.CloseFigure();
			var m = Matrix.Create();
			var c = new PointF((float)t.CenterX, (float)t.CenterY);
			// translate
			m.Translate((float)t.OffsetX, (float)t.OffsetY);
			// rotate
			m.RotateAt((float)t.RotateAngle, c);
			// skew
			m.Translate(-c.X, -c.Y);
			m.Prepend(Matrix.Create(1, (float)Math.Tan(Math.PI * t.SkewAngleY / 180.0), (float)Math.Tan(Math.PI * t.SkewAngleX / 180.0), 1, 0, 0));
			m.Translate(c.X, c.Y);
			// scale
			m.ScaleAt((float)t.ScaleX, (float)t.ScaleY, (float)t.CenterX, (float)t.CenterY);
			graphics.SaveTransform();
			graphics.MultiplyTransform(m);
			var brush = new SolidBrush(Colors.Black);
			var pen = new Pen(Colors.Red, 0.5f);
			graphics.FillPath(brush, path);
			graphics.DrawPath(pen, path);
			brush.Dispose();
			pen.Dispose();
			graphics.RestoreTransform();
		}
开发者ID:mhusen,项目名称:Eto,代码行数:101,代码来源:PixelOffsetTransforms.cs


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