Pilz.UI: convert to C#

This commit is contained in:
2024-06-10 12:29:56 +02:00
parent b9be604f0d
commit 5c6f0c8bfc
32 changed files with 3950 additions and 166 deletions

View File

@@ -0,0 +1,8 @@
using System;
namespace Pilz.UI;
public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs
{
public PaintingObject[] PaintingObjects { get; private set; } = paintingObjects;
}

View File

@@ -0,0 +1,53 @@
using System;
using System.Drawing;
namespace Pilz.UI;
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
{
/// <summary>
/// The Painting Object to draw.
/// </summary>
/// <returns></returns>
public PaintingObject PaintingObject { get; } = obj;
/// <summary>
/// The current offset of the page on the screen.
/// </summary>
/// <returns></returns>
public PointF Offset { get; } = offset;
/// <summary>
/// The Grpahics from the parent PaintingControl.
/// </summary>
/// <returns></returns>
public Graphics Graphics { get; } = g;
/// <summary>
/// The position of the PaintingObject on Screen.
/// </summary>
/// <returns></returns>
public PointF Location => new(X, Y);
/// <summary>
/// The X position of the PaintingObject on Screen.
/// </summary>
/// <returns></returns>
public float X => PaintingObject.X - Offset.X;
/// <summary>
/// The Y position of the PaintingObject on Screen.
/// </summary>
/// <returns></returns>
public float Y => PaintingObject.Y - Offset.Y;
/// <summary>
/// The rectangle of the PaintingObject on Screen.
/// </summary>
/// <returns></returns>
public RectangleF Rectangle => new RectangleF(X, Y, PaintingObject.Width, PaintingObject.Height);
public PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g) : this(obj, g, obj.Parent.Offset)
{
}
}