//
// System.Drawing.Margins.cs
//
// Author:
// Dennis Hayes (dennish@Raytek.com)
//
// (C) 2002 Ximian, Inc
//
using System;
namespace System.Drawing.Printing {
///
/// Summary description for Margins.
///
public class Margins : ICloneable {
///
/// left margin in hundredths of an inch
///
int left;
///
/// right margin in hundredths of an inch
///
int right;
///
/// top margin in hundredths of an inch
///
int top;
///
/// bottom margin in hundredths of an inch
///
int bottom;
public Margins() {
left = 100;
right = 100;
top = 100;
bottom = 100;
}
public Margins(int left, int right, int top, int bottom) {
//Verify parameters
if(left < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "left");
if(right < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "right");
if(top < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "top");
if(bottom < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "bottom");
//Set proprities
this.left = left;
this.right = right;
this.top = top;
this.bottom = bottom;
}
public int Left{
get{
return left;
}
set{
left = value;
}
}
public int Right{
get{
return right;
}
set{
right = value;
}
}
public int Top{
get{
return top;
}
set{
top = value;
}
}
public int Bottom{
get{
return bottom;
}
set{
bottom = value;
}
}
public object Clone()
{
return new Margins(this.Left, this.Right, this.Top, this.Bottom);
}
public override string ToString()
{
string ret = "[Margins Left={0} Right={1} Top={2} Bottom={3}]";
return String.Format(ret, this.Left, this.Right, this.Top, this.Bottom);
}
}
}