//
// System.Drawing.Margins.cs
//
-// Author:
+// Authors:
// Dennis Hayes (dennish@Raytek.com)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc
//
-using System;
-namespace System.Drawing.Printing {
- /// <summary>
- /// Summary description for Margins.
- /// </summary>
+using System;
+using System.ComponentModel;
- public class Margins : ICloneable {
- /// <summary>
- /// left margin in hundredths of an inch
- /// </summary>
+namespace System.Drawing.Printing
+{
+ [TypeConverter (typeof (MarginsConverter))]
+ public class Margins : ICloneable
+ {
int left;
- /// <summary>
- /// right margin in hundredths of an inch
- /// </summary>
int right;
- /// <summary>
- /// top margin in hundredths of an inch
- /// </summary>
int top;
- /// <summary>
- /// bottom margin in hundredths of an inch
- /// </summary>
int bottom;
- public Margins() {
+ public Margins()
+ {
left = 100;
right = 100;
top = 100;
bottom = 100;
}
- public Margins(int left, int right, int top, int bottom) {
+
+ public Margins(int left, int right, int top, int bottom)
+ {
//Verify parameters
- if(left < 0)
+ if (left < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "left");
- if(right < 0)
+ if (right < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "right");
- if(top < 0)
+ if (top < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "top");
- if(bottom < 0)
+ if (bottom < 0)
throw new System.ArgumentException("All Margins must be greater than 0", "bottom");
+
//Set proprities
this.left = left;
this.right = right;
this.bottom = bottom;
}
- public int Left{
- get{
+ public int Left {
+ get {
return left;
}
- set{
+ set {
+ if (left < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "left");
left = value;
}
}
- public int Right{
- get{
+ public int Right {
+ get {
return right;
}
- set{
+ set {
+ if (right < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "left");
right = value;
}
}
- public int Top{
- get{
+ public int Top {
+ get {
return top;
}
- set{
+ set {
+ if (top < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "left");
top = value;
}
}
- public int Bottom{
- get{
+ public int Bottom {
+ get {
return bottom;
}
- set{
+ set {
+ if (bottom < 0)
+ throw new System.ArgumentException("All Margins must be greater than 0", "left");
bottom = value;
}
}
public object Clone()
{
- return new Margins(this.Left, this.Right, this.Top, this.Bottom);
+ return new Margins (this.Left, this.Right, this.Top, this.Bottom);
+ }
+
+ public override bool Equals (object obj)
+ {
+ Margins m = obj as Margins;
+
+ if (m == null)
+ return false;
+ if (m.Left == left && m.Right == right && m.Top == top && m.Bottom == bottom)
+ return true;
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ // Try to create a somewhat meaningful hash
+ int hash = left + right * 2^8 + top * 2^16 + bottom * 2^24;
+ return hash;
}
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);
+ return String.Format (ret, this.Left, this.Right, this.Top, this.Bottom);
}
}
}
//
// System.Drawing.PrintDocument.cs
//
-// Author:
+// Authors:
// Dennis Hayes (dennish@Raytek.com)
// Herve Poussineau (hpoussineau@fr.st)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc
//
+
using System;
+using System.ComponentModel;
-namespace System.Drawing.Printing {
- /// <summary>
- /// Summary description for PrintDocument.
- /// </summary>
- public class PrintDocument : System.ComponentModel.Component {
+namespace System.Drawing.Printing
+{
+ [DefaultEvent ("PrintPage"), DefaultProperty ("DocumentName")]
+ [ToolboxItemFilter ("System.Drawing.Printing", ToolboxItemFilterType.Allow)]
+ [DesignerCategory ("Component")]
+ public class PrintDocument : System.ComponentModel.Component
+ {
private PageSettings defaultpagesettings;
private PrinterSettings printersettings;
private PrintController printcontroller;
printcontroller = new StandardPrintController();
}
-// properties
+ // properties
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [SRDescription ("The settings for the current page.")]
public PageSettings DefaultPageSettings{
get{
return defaultpagesettings;
defaultpagesettings = value;
}
}
- /// <summary>
- /// Name of the document, not the file!
- /// </summary>
+
+ // Name of the document, not the file!
+ [DefaultValue ("document")]
+ [SRDescription ("The name of the document.")]
public string DocumentName{
get{
return documentname;
documentname = value;
}
}
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [SRDescription ("The print controller object.")]
public PrintController PrintController{
get{
return printcontroller;
printcontroller = value;
}
}
+
+ [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
+ [Browsable (false)]
+ [SRDescription ("The current settings for the active printer.")]
public PrinterSettings PrinterSettings{
get{
return printersettings;
printersettings = value;
}
}
+
#if !(NET_1_0)
- public bool OriginAtMargins{// .NET V1.1 Beta
+ [DefaultValue (false)]
+ [SRDescription ("Determines if the origin is set at the specified margins.")]
+ public bool OriginAtMargins{
get{
return originAtMargins;
}
}
#endif
-// methods
+ // methods
public void Print(){
PrintEventArgs printArgs = new PrintEventArgs();
this.OnBeginPrint(printArgs);
this.OnEndPrint(printArgs);
PrintController.OnEndPrint(this, printArgs);
}
+
public override string ToString(){
return "[PrintDocument " + this.DocumentName + "]";
}
-// events
+ // events
protected virtual void OnBeginPrint(PrintEventArgs e){
//fire the event
if (BeginPrint != null)
protected virtual void OnQueryPageSettings(QueryPageSettingsEventArgs e){
//fire the event
- if (QuerypageSettings != null)
- QuerypageSettings(this, e);
+ if (QueryPageSettings != null)
+ QueryPageSettings(this, e);
}
-
+
+ [SRDescription ("Raised when printing begins")]
public event PrintEventHandler BeginPrint;
+
+ [SRDescription ("Raised when printing ends")]
public event PrintEventHandler EndPrint;
+
+ [SRDescription ("Raised when printing of a new page begins")]
public event PrintPageEventHandler PrintPage;
- public event QueryPageSettingsEventHandler QuerypageSettings;
+
+ [SRDescription ("Raised before printing of a new page begins")]
+ public event QueryPageSettingsEventHandler QueryPageSettings;
}
}
//
// System.Drawing.PrinterSettings.cs
//
-// Author:
+// Authors:
// Dennis Hayes (dennish@Raytek.com)
// Herve Poussineau (hpoussineau@fr.st)
+// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2002 Ximian, Inc
//
+
using System;
+using System.Runtime.InteropServices;
using System.Collections;
using System.Drawing.Printing;
namespace System.Drawing.Printing
{
- /// <summary>
- /// Summary description for PrinterSettings.
- /// </summary>
- ///
[Serializable]
- //[ComVisible(false)]
- public class PrinterSettings : ICloneable{
+ [ComVisible(false)]
+ public class PrinterSettings : ICloneable
+ {
public PrinterSettings()
{
}
- // SUBCLASS
- /// <summary>
- /// Summary description for PaperSourceCollection.
- /// </summary>
- public class PaperSourceCollection : ICollection, IEnumerable {
+
+ // Public subclasses
+
+ public class PaperSourceCollection : ICollection
+ {
ArrayList _PaperSources = new ArrayList();
public PaperSourceCollection(PaperSource[] array) {
get { return _PaperSources[index] as PaperSource; }
}
- IEnumerator IEnumerable.GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return _PaperSources.GetEnumerator();
}
_PaperSources.CopyTo(array, index);
}
}
- /// <summary>
- /// Summary description for PaperSizeCollection.
- /// </summary>
- public class PaperSizeCollection : ICollection, IEnumerable {
+
+ public class PaperSizeCollection : ICollection
+ {
ArrayList _PaperSizes = new ArrayList();
public PaperSizeCollection(PaperSize[] array) {
get { return _PaperSizes[index] as PaperSize; }
}
- IEnumerator IEnumerable.GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return _PaperSizes.GetEnumerator();
}
_PaperSizes.CopyTo(array, index);
}
}
- /// <summary>
- /// Summary description for PrinterResolutionCollection.
- /// </summary>
- public class PrinterResolutionCollection : ICollection, IEnumerable {
+
+ public class PrinterResolutionCollection : ICollection
+ {
ArrayList _PrinterResolutions = new ArrayList();
public PrinterResolutionCollection(PrinterResolution[] array) {
get { return _PrinterResolutions[index] as PrinterResolution; }
}
- IEnumerator IEnumerable.GetEnumerator()
+ public IEnumerator GetEnumerator()
{
return _PrinterResolutions.GetEnumerator();
}
_PrinterResolutions.CopyTo(array, index);
}
}
- /// <summary>
- /// Summary description for PrinterResolutionCollection.
- /// </summary>
- public class StringCollection : ICollection, IEnumerable {
+
+ public class StringCollection : ICollection
+ {
ArrayList _Strings = new ArrayList();
public StringCollection(string[] array) {
_Strings.Add(s);
}
- int ICollection.Count { get { return _Strings.Count; } }
+ public int Count { get { return _Strings.Count; } }
bool ICollection.IsSynchronized { get { return false; } }
object ICollection.SyncRoot { get { return this; } }
- IEnumerator IEnumerable.GetEnumerator()
+ public virtual string this[int index] {
+ get { return _Strings[index] as string; }
+ }
+
+ public IEnumerator GetEnumerator()
{
return _Strings.GetEnumerator();
}
}
}
-//props
- //[MonoTODO("PrinterSettings.CanDuplex")]
- //public bool CanDuplex
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.Collate")]
- //public bool Collate
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.Copies")]
- //public short Copies
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
+ //properties
+
+ [MonoTODO("PrinterSettings.CanDuplex")]
+ public bool CanDuplex
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.Collate")]
+ public bool Collate
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.Copies")]
+ public short Copies
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
[MonoTODO("PrinterSettings.DefaultPageSettings")]
public PageSettings DefaultPageSettings
{
);
}
}
- //[MonoTODO("PrinterSettings.Duplex")]
- //public Duplex Duplex
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.FromPage)]
- //public int FromPage
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.InstalledPrinters")]
- //public static PrinterSettings.StringCollection InstalledPrinters
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.IsDefaultPrinter")]
- //public bool IsDefaultPrinter
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.IsPlotter")]
- //public bool IsPlotter
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.IsValid")]
- //public bool IsValid
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.LandscapeAngle")]
- //public int LandscapeAngle
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.MaximumCopies")]
- //public int MaximumCopies
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.MaximumPage")]
- //public int MaximumPage
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.MinimumPage")]
- //public int MinimumPage
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PaperSizes")]
- //public PrinterSettings.PaperSizeCollection PaperSizes
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PaperSources")]
- //public PrinterSettings.PaperSourceCollection PaperSources
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PrinterName")]
- //public string PrinterName
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PrinterResolutions")]
- //public PrinterSettings.PrinterResolutionCollection PrinterResolutions
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PrintRange")]
- //public PrintRange PrintRange
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.PrintToFile")]
- //public bool PrintToFile
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.SupportsColor")]
- //public bool SupportsColor
- //{
- // get { throw new NotImplementedException(); }
- //}
- //[MonoTODO("PrinterSettings.ToPage")]
- //public int ToPage
- //{
- // get { throw new NotImplementedException(); }
- // set { throw new NotImplementedException(); }
- //}
-
-//methods
+
+ [MonoTODO("PrinterSettings.Duplex")]
+ public Duplex Duplex
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.FromPage")]
+ public int FromPage
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.InstalledPrinters")]
+ public static PrinterSettings.StringCollection InstalledPrinters
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.IsDefaultPrinter")]
+ public bool IsDefaultPrinter
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.IsPlotter")]
+ public bool IsPlotter
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.IsValid")]
+ public bool IsValid
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.LandscapeAngle")]
+ public int LandscapeAngle
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.MaximumCopies")]
+ public int MaximumCopies
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.MaximumPage")]
+ public int MaximumPage
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.MinimumPage")]
+ public int MinimumPage
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PaperSizes")]
+ public PrinterSettings.PaperSizeCollection PaperSizes
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PaperSources")]
+ public PrinterSettings.PaperSourceCollection PaperSources
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PrinterName")]
+ public string PrinterName
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PrinterResolutions")]
+ public PrinterSettings.PrinterResolutionCollection PrinterResolutions
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PrintRange")]
+ public PrintRange PrintRange
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.PrintToFile")]
+ public bool PrintToFile
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.SupportsColor")]
+ public bool SupportsColor
+ {
+ get { throw new NotImplementedException(); }
+ }
+
+ [MonoTODO("PrinterSettings.ToPage")]
+ public int ToPage
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
+ //methods
+
[MonoTODO("PrinterSettings.Clone")]
public virtual object Clone()
{
throw new NotImplementedException();
}
- //[MonoTODO("PrinterSettings.CreateMeasurementGraphics")]
- //public Graphics CreateMeasurementGraphics()
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.GetHdevmode")]
- //public IntPtr GetHdevmode()
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.GetHdevmode")]
- //public IntPtr GetHdevmode(PageSettings pageSettings)
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.GetHdevname")]
- //public IntPtr GetHdevnames()
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.SetHdevmode")]
- //public void SetHdevmode(IntPtr hdevmode)
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.SetHdevnames")]
- //public void SetHdevnames(IntPtr hdevnames)
- //{
- // throw new NotImplementedException();
- //}
- //[MonoTODO("PrinterSettings.ToString"]
- //public override string ToString()
- //{
- // throw new NotImplementedException();
- //}
+
+ [MonoTODO("PrinterSettings.CreateMeasurementGraphics")]
+ public Graphics CreateMeasurementGraphics()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.GetHdevmode")]
+ public IntPtr GetHdevmode()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.GetHdevmode")]
+ public IntPtr GetHdevmode(PageSettings pageSettings)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.GetHdevname")]
+ public IntPtr GetHdevnames()
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.SetHdevmode")]
+ public void SetHdevmode(IntPtr hdevmode)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.SetHdevnames")]
+ public void SetHdevnames(IntPtr hdevnames)
+ {
+ throw new NotImplementedException();
+ }
+
+ [MonoTODO("PrinterSettings.ToString")]
+ public override string ToString()
+ {
+ throw new NotImplementedException();
+ }
}
}