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


C# Drawing.PointF类代码示例

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


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

示例1: BrushSection

		public BrushSection()
		{
			var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };

			// defaults
			ScaleX = 100f;
			ScaleY = 100f;
			Center = new PointF(100, 50);
			GradientOrigin = new PointF(150, 80);
			Radius = new SizeF(100f, 50f);
			StartPoint = new PointF(50, 50);
			EndPoint = new PointF(100, 100);

			drawable = new Drawable { Size = new Size(450, 400) };

			drawable.Paint += (sender, pe) => Draw(pe.Graphics);

			layout.AddSeparateRow(null, BrushControl(), UseBackgroundColorControl(), null);
			if (Platform.Supports<NumericUpDown>())
			{
				matrixRow = layout.AddSeparateRow(null, new Label { Text = "Rot" }, RotationControl(), new Label { Text = "Sx" }, ScaleXControl(), new Label { Text = "Sy" }, ScaleYControl(), new Label { Text = "Ox" }, OffsetXControl(), new Label { Text = "Oy" }, OffsetYControl(), null);
				matrixRow.Table.Visible = false;
			}
			gradientRow = layout.AddSeparateRow(null, GradientWrapControl(), null);
			gradientRow.Table.Visible = false;
			radialRow = layout.AddSeparateRow(null, "Center:", CenterControl(), "GradientOrigin:", GradientOriginControl(), null);
			radiusRow = layout.AddSeparateRow(null, "Radius:", RadiusControl(), null);
			linearRow = layout.AddSeparateRow(null, "Start:", StartPointControl(), "End:", EndPointControl(), null);
			layout.AddSeparateRow(null, drawable, null);
			layout.Add(null);

			this.Content = layout;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:33,代码来源:BrushSection.cs

示例2: GetPixelSection

		public GetPixelSection()
		{
			var location = new Point(100, 100);
			var image = TestIcons.Textures;
			var drawable = new BufferedDrawable { EnableDoubleBuffering = true };
			this.Content = drawable;

			EventHandler<MouseEventArgs> mouseHandler = (s, e) =>
			{
				location = new Point(e.Location);
				((Control)s).Invalidate();
				e.Handled = true;
			};

			drawable.MouseMove += mouseHandler;
			drawable.MouseDown += mouseHandler;

			var font = SystemFonts.Default();
			drawable.BackgroundColor = Colors.Green;
			drawable.Paint += (s, e) =>
			{
				var graphics = e.Graphics;
				var imageLocation = new PointF(100, 100);
				graphics.DrawText(font, Colors.White, 3, 3, "Move the mouse in this area to read the pixel color.");
				graphics.DrawImage(image, imageLocation);

				var loc = location - (Point)imageLocation;
				loc.Restrict(new Rectangle(image.Size));
				var pixelColor = image.GetPixel(loc.X, loc.Y);
				graphics.DrawText(font, Colors.White, 3, 20, "Color: " + pixelColor);
			};
		}
开发者ID:mhusen,项目名称:Eto,代码行数:32,代码来源:GetPixelSection.cs

示例3: RectangleF

		public RectangleF(PointF start, PointF end)
		{
			this.x = start.X;
			this.y = start.Y;
			this.width = (end.X >= start.X) ? end.X - start.X + 1 : end.X - start.X;
			this.height = (end.Y >= start.Y) ? end.Y - start.Y + 1: end.Y - start.Y;
		}
开发者ID:hultqvist,项目名称:Eto,代码行数:7,代码来源:RectangleF.cs

示例4: Create

		public object Create (Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			return new swm.LinearGradientBrush (startColor.ToWpf (), endColor.ToWpf (), startPoint.ToWpf (), endPoint.ToWpf ()) {
				MappingMode = swm.BrushMappingMode.Absolute,
				SpreadMethod = swm.GradientSpreadMethod.Repeat
			};
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:7,代码来源:LinearGradientBrushHandler.cs

示例5: Create

		public object Create (Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			var gradient = new EtoGradient (startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
			gradient.Extend = Cairo.Extend.Pad;
			gradient.AddColorStop (0, startColor.ToCairo ());
			gradient.AddColorStop (1, endColor.ToCairo ());
			return gradient;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:8,代码来源:LinearGradientBrushHandler.cs

示例6: EtoGradient

			public EtoGradient(PointF origin, PointF center, SizeF radius)
				: base(origin.X, origin.Y, 0, center.X, origin.Y - (origin.Y - center.Y) / (radius.Height / radius.Width), radius.Width)
			{
				
				Center = center;
				GradientOrigin = origin;
				Radius = radius;
			}
开发者ID:mhusen,项目名称:Eto,代码行数:8,代码来源:RadialGradientBrushHandler.cs

示例7: MouseEventArgs

		public MouseEventArgs(MouseButtons buttons, Keys modifiers, PointF location, SizeF? delta = null)
		{
			this.Modifiers = modifiers;
			this.Buttons = buttons;
			this.Location = location;
			this.Pressure = 1.0f;
			this.Delta = delta ?? SizeF.Empty;
		}
开发者ID:Exe0,项目名称:Eto,代码行数:8,代码来源:MouseEventArgs.cs

示例8: ConnectTo

			public void ConnectTo (PointF point)
			{
				if (First) {
					Context.MoveTo (point.X, point.Y);
					First = false;
				} else
					Context.LineTo (point.X, point.Y);
				ForceConnect = false;
			}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:9,代码来源:GraphicsPathHandler.cs

示例9: SetStart

			public bool SetStart (PointF point)
			{
				First = false;
				if (ForceConnect) {
					ConnectTo (point);
					return false;
				}
				return true;
			}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:9,代码来源:GraphicsPathHandler.cs

示例10: Create

		public object Create (Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			var gradient = new EtoGradient (startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
			cairo_pattern_set_extend (gradient.Pointer, Cairo.Extend.Repeat);
			// not in windows?? gradient.Extend = Cairo.Extend.Repeat;
			gradient.AddColorStop (0, startColor.ToCairo ());
			gradient.AddColorStop (1, endColor.ToCairo ());
			return gradient;
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:9,代码来源:LinearGradientBrushHandler.cs

示例11: AddLine

 public void AddLine(PointF point1, PointF point2)
 {
     sink.AddLines(
         new s.DrawingPointF[]
         {
             point1.ToWpf(),
             point2.ToWpf()                   
         });
 }
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:9,代码来源:GraphicsPathHandler.cs

示例12: AddLines

		public void AddLines (IEnumerable<PointF> points)
		{
			var pointsList = points as IList<PointF> ?? points.ToArray ();
			ConnectTo (pointsList.First ().ToWpf ());

			var wpfPoints = from p in pointsList select p.ToWpf ();
			figure.Segments.Add (new swm.PolyLineSegment (wpfPoints, true));
			CurrentPoint = pointsList.Last ();
		}
开发者ID:gene-l-thomas,项目名称:Eto,代码行数:9,代码来源:GraphicsPathHandler.cs

示例13: Create

		public object Create(Color startColor, Color endColor, PointF center, PointF gradientOrigin, SizeF radius)
		{
			var gradient = new EtoGradient(gradientOrigin, center, radius);
			gradient.Radius = radius;
			gradient.Extend = Cairo.Extend.Pad;
			gradient.AddColorStop(0, startColor.ToCairo());
			gradient.AddColorStop(1, endColor.ToCairo());
			return gradient;
		}
开发者ID:mhusen,项目名称:Eto,代码行数:9,代码来源:RadialGradientBrushHandler.cs

示例14: Create

		public object Create(Color startColor, Color endColor, PointF startPoint, PointF endPoint)
		{
			return new LinearBrushData
			{
				StartColor = startColor,
				EndColor = endColor,
				StartPoint = startPoint,
				EndPoint = endPoint
			};
		}
开发者ID:alexandrebaker,项目名称:Eto,代码行数:10,代码来源:LinearGradientBrushHandler.cs

示例15: Box

			public Box (Size canvasSize, bool useTexturesAndGradients)
			{
				var size = new SizeF(random.Next (50) + 50, random.Next (50) + 50);
				var location = new PointF(random.Next (canvasSize.Width - (int)size.Width), random.Next (canvasSize.Height - (int)size.Height));
				position = new RectangleF(location, size);
				increment = new SizeF (random.Next (3) + 1, random.Next (3) + 1);
				if (random.Next (2) == 1)
					increment.Width = -increment.Width;
				if (random.Next (2) == 1)
					increment.Height = -increment.Height;

				angle = random.Next (360);
				rotation = (random.Next (20) - 10f) / 4f;

				var rect = new RectangleF (size);
				color = GetRandomColor (random);
				switch (random.Next (useTexturesAndGradients ? 4 : 2)) {
				case 0:
					draw = (g) => g.DrawRectangle (color, rect);
					erase = (g) => g.DrawRectangle (Colors.Black, rect);
					break;
				case 1:
					draw = (g) => g.DrawEllipse (color, rect);
					erase = (g) => g.DrawEllipse (Colors.Black, rect);
					break;
				case 2:
					switch (random.Next (2)) {
					case 0:
						fillBrush = new LinearGradientBrush (GetRandomColor (random), GetRandomColor (random), PointF.Empty, new PointF(size.Width, size.Height));
						break;
					case 1:
						fillBrush = new TextureBrush(texture) {
							Transform = Matrix.FromScale (size / 80)
						};
						break;
					}
					draw = (g) => g.FillEllipse (fillBrush, rect);
					erase = (g) => g.FillEllipse (Colors.Black, rect);
					break;
				case 3:
					switch (random.Next (2)) {
					case 0:
						fillBrush = new LinearGradientBrush (GetRandomColor (random), GetRandomColor (random), PointF.Empty, new PointF(size.Width, size.Height));
						break;
					case 1:
						fillBrush = new TextureBrush(texture) {
							Transform = Matrix.FromScale (size / 80)
						};
						break;
					}
					draw = (g) => g.FillRectangle (fillBrush, rect);
					erase = (g) => g.FillRectangle (Colors.Black, rect);
					break;
				}
			}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:55,代码来源:DirectDrawingSection.cs


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