PaperSize.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // System.Drawing.PaperSize.cs
  3. //
  4. // Author:
  5. // Dennis Hayes ([email protected])
  6. // Herve Poussineau ([email protected])
  7. //
  8. // (C) 2002 Ximian, Inc
  9. //
  10. //
  11. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  12. //
  13. // Permission is hereby granted, free of charge, to any person obtaining
  14. // a copy of this software and associated documentation files (the
  15. // "Software"), to deal in the Software without restriction, including
  16. // without limitation the rights to use, copy, modify, merge, publish,
  17. // distribute, sublicense, and/or sell copies of the Software, and to
  18. // permit persons to whom the Software is furnished to do so, subject to
  19. // the following conditions:
  20. //
  21. // The above copyright notice and this permission notice shall be
  22. // included in all copies or substantial portions of the Software.
  23. //
  24. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  28. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  29. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  30. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  31. //
  32. using System;
  33. namespace System.Drawing.Printing
  34. {
  35. /// <summary>
  36. /// Summary description for PaperSize.
  37. /// </summary>
  38. #if NET_2_0
  39. [Serializable]
  40. #endif
  41. public class PaperSize
  42. {
  43. string name;
  44. int width;
  45. int height;
  46. PaperKind kind;
  47. #if NET_2_0
  48. public PaperSize ()
  49. {
  50. }
  51. #endif
  52. public PaperSize(string name, int width, int height)
  53. {
  54. this.width = width;
  55. this.height = height;
  56. this.name = name;
  57. this.kind = PaperKind.Custom;
  58. }
  59. public int Width{
  60. get{
  61. return width;
  62. }set
  63. {
  64. if (Kind != PaperKind.Custom)
  65. throw new ArgumentException();
  66. width = value;
  67. }
  68. }
  69. public int Height{
  70. get{
  71. return height;
  72. }set
  73. {
  74. if (Kind != PaperKind.Custom)
  75. throw new ArgumentException();
  76. height = value;
  77. }
  78. }
  79. public string PaperName{
  80. get{
  81. return name;
  82. }
  83. set{
  84. if (Kind != PaperKind.Custom)
  85. throw new ArgumentException();
  86. name = value;
  87. }
  88. }
  89. public PaperKind Kind{
  90. get{
  91. return kind;
  92. }
  93. }
  94. #if NET_2_0
  95. [MonoTODO]
  96. public int RawKind {
  97. get { throw new NotImplementedException(); }
  98. set { throw new NotImplementedException(); }
  99. }
  100. #endif
  101. public override string ToString(){
  102. string ret = "[PaperSize {0} Kind={1} Height={2} Width={3}]";
  103. return String.Format(ret, this.PaperName, this.Kind, this.Height, this.Width);
  104. }
  105. }
  106. }