68 lines
1.5 KiB
C#
68 lines
1.5 KiB
C#
using System;
|
|
|
|
namespace CPF.ReoGrid.Print
|
|
{
|
|
[Serializable]
|
|
public struct PageMargins
|
|
{
|
|
public float Top { readonly get; set; }
|
|
|
|
public float Bottom { readonly get; set; }
|
|
|
|
public float Left { readonly get; set; }
|
|
|
|
public float Right { readonly get; set; }
|
|
|
|
public PageMargins(float all)
|
|
{
|
|
this = default(PageMargins);
|
|
this.Top = all;
|
|
this.Bottom = all;
|
|
this.Left = all;
|
|
this.Right = all;
|
|
}
|
|
|
|
public PageMargins(float top, float bottom, float left, float right)
|
|
{
|
|
this = default(PageMargins);
|
|
this.Top = top;
|
|
this.Bottom = bottom;
|
|
this.Left = left;
|
|
this.Right = right;
|
|
}
|
|
|
|
public static bool operator ==(PageMargins p1, PageMargins p2)
|
|
{
|
|
return p1.Left == p2.Left && p1.Top == p2.Top && p1.Right == p2.Right && p1.Bottom == p2.Bottom;
|
|
}
|
|
|
|
public static bool operator !=(PageMargins p1, PageMargins p2)
|
|
{
|
|
return p1.Left != p2.Left || p1.Top != p2.Top || p1.Right != p2.Right || p1.Bottom != p2.Bottom;
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
bool flag = !(obj is PageMargins);
|
|
bool result;
|
|
if (flag)
|
|
{
|
|
result = false;
|
|
}
|
|
else
|
|
{
|
|
PageMargins pageMargins = (PageMargins)obj;
|
|
result = (this.Top == pageMargins.Top && this.Left == pageMargins.Left && this.Right == pageMargins.Right && this.Bottom == pageMargins.Bottom);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return (int)(this.Top + this.Left * 10f + this.Right * 100f + this.Bottom * 1000f);
|
|
}
|
|
|
|
public static readonly PageMargins Empty = new PageMargins(0f);
|
|
}
|
|
}
|