Margins.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //
  2. // System.Drawing.Margins.cs
  3. //
  4. // Author:
  5. // Dennis Hayes ([email protected])
  6. //
  7. // (C) 2002 Ximian, Inc
  8. //
  9. using System;
  10. namespace System.Drawing.Printing {
  11. /// <summary>
  12. /// Summary description for Margins.
  13. /// </summary>
  14. public class Margins {// : IClonable {
  15. /// <summary>
  16. /// left margin in hundredths of an inch
  17. /// </summary>
  18. int left;
  19. /// <summary>
  20. /// right margin in hundredths of an inch
  21. /// </summary>
  22. int right;
  23. /// <summary>
  24. /// top margin in hundredths of an inch
  25. /// </summary>
  26. int top;
  27. /// <summary>
  28. /// bottom margin in hundredths of an inch
  29. /// </summary>
  30. int bottom;
  31. public Margins() {
  32. left = 100;
  33. right = 100;
  34. top = 100;
  35. bottom = 100;
  36. }
  37. public Margins(int left, int right, int top, int bottom) {
  38. //Verify parameters
  39. if(left < 0)
  40. throw new System.ArgumentException("All Margins must be greater than 0", "left");
  41. if(right < 0)
  42. throw new System.ArgumentException("All Margins must be greater than 0", "right");
  43. if(top < 0)
  44. throw new System.ArgumentException("All Margins must be greater than 0", "top");
  45. if(bottom < 0)
  46. throw new System.ArgumentException("All Margins must be greater than 0", "bottom");
  47. //Set proprities
  48. this.left = left;
  49. this.right = right;
  50. this.top = top;
  51. this.bottom = bottom;
  52. }
  53. public int Left{
  54. get{
  55. return left;
  56. }
  57. set{
  58. left = value;
  59. }
  60. }
  61. public int Right{
  62. get{
  63. return right;
  64. }
  65. set{
  66. right = value;
  67. }
  68. }
  69. public int Top{
  70. get{
  71. return top;
  72. }
  73. set{
  74. top = value;
  75. }
  76. }
  77. public int Bottom{
  78. get{
  79. return bottom;
  80. }
  81. set{
  82. bottom = value;
  83. }
  84. }
  85. }
  86. }