Files
Pilz/Pilz.UI/PaintingControl/EventArgs/PaintingObjectPaintEventArgs.cs
2020-09-24 11:21:53 +02:00

86 lines
2.1 KiB
C#

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