convert VB to C#
This commit is contained in:
14
Pilz.UI/PaintingControl/EventArgs/PaintingObjectEventArgs.cs
Normal file
14
Pilz.UI/PaintingControl/EventArgs/PaintingObjectEventArgs.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace Pilz.UI
|
||||
{
|
||||
public class PaintingObjectEventArgs : EventArgs
|
||||
{
|
||||
public PaintingObject[] PaintingObjects { get; private set; } = null;
|
||||
|
||||
internal PaintingObjectEventArgs(PaintingObject[] paintingObjects)
|
||||
{
|
||||
PaintingObjects = paintingObjects;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
Imports System.Drawing
|
||||
Imports System.IO
|
||||
Imports System.Windows.Forms
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Public Class PaintingObjectEventArgs
|
||||
Inherits EventArgs
|
||||
|
||||
Public ReadOnly Property PaintingObjects As PaintingObject() = Nothing
|
||||
|
||||
Friend Sub New(paintingObjects As PaintingObject())
|
||||
_PaintingObjects = paintingObjects
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,86 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
Imports System.Drawing
|
||||
Imports System.IO
|
||||
Imports System.Windows.Forms
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Public Class PaintingObjectPaintEventArgs
|
||||
Inherits EventArgs
|
||||
|
||||
''' <summary>
|
||||
''' The Painting Object to draw.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property PaintingObject As PaintingObject
|
||||
|
||||
''' <summary>
|
||||
''' The current offset of the page on the screen.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Offset As PointF
|
||||
|
||||
''' <summary>
|
||||
''' The Grpahics from the parent PaintingControl.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Graphics As Graphics
|
||||
|
||||
''' <summary>
|
||||
''' The position of the PaintingObject on Screen.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Location As PointF
|
||||
Get
|
||||
Return New PointF(X, Y)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' The X position of the PaintingObject on Screen.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property X As Single
|
||||
Get
|
||||
Return PaintingObject.X - Offset.X
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' The Y position of the PaintingObject on Screen.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Y As Single
|
||||
Get
|
||||
Return PaintingObject.Y - Offset.Y
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' The rectangle of the PaintingObject on Screen.
|
||||
''' </summary>
|
||||
''' <returns></returns>
|
||||
Public ReadOnly Property Rectangle As RectangleF
|
||||
Get
|
||||
Return New RectangleF(X, Y, PaintingObject.Width, PaintingObject.Height)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Friend Sub New(obj As PaintingObject, g As Graphics)
|
||||
Me.New(obj, g, obj.Parent.Offset)
|
||||
End Sub
|
||||
|
||||
Friend Sub New(obj As PaintingObject, g As Graphics, offset As PointF)
|
||||
PaintingObject = obj
|
||||
Me.Offset = offset
|
||||
Graphics = g
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user