PaperSize.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. using System;
  11. namespace System.Drawing.Printing
  12. {
  13. /// <summary>
  14. /// Summary description for PaperSize.
  15. /// </summary>
  16. public class PaperSize
  17. {
  18. string name;
  19. int width;
  20. int height;
  21. PaperKind kind;
  22. public PaperSize(string name, int width, int height)
  23. {
  24. this.width = width;
  25. this.height = height;
  26. this.name = name;
  27. this.kind = PaperKind.Custom;
  28. }
  29. public int Width{
  30. get{
  31. return width;
  32. }set
  33. {
  34. if (Kind != PaperKind.Custom)
  35. throw new ArgumentException();
  36. width = value;
  37. }
  38. }
  39. public int Height{
  40. get{
  41. return height;
  42. }set
  43. {
  44. if (Kind != PaperKind.Custom)
  45. throw new ArgumentException();
  46. height = value;
  47. }
  48. }
  49. public string PaperName{
  50. get{
  51. return name;
  52. }
  53. set{
  54. if (Kind != PaperKind.Custom)
  55. throw new ArgumentException();
  56. name = value;
  57. }
  58. }
  59. public PaperKind Kind{
  60. get{
  61. return kind;
  62. }
  63. }
  64. public override string ToString(){
  65. string ret = "[PaperSize {0} Kind={1} Height={2} Width={3}]";
  66. return String.Format(ret, this.PaperName, this.Kind, this.Height, this.Width);
  67. }
  68. }
  69. }