Padding.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using QuestPDF.Examples.Engine;
  2. using QuestPDF.Fluent;
  3. using QuestPDF.Infrastructure;
  4. namespace QuestPDF.Examples
  5. {
  6. public class Examples : ExampleTestBase
  7. {
  8. public void Padding(IContainer container)
  9. {
  10. container
  11. .Background("#FDD")
  12. .Padding(50)
  13. .Background("#AFA")
  14. .PaddingVertical(50)
  15. .Background("#77F")
  16. .PaddingHorizontal(50)
  17. .Background("#444");
  18. }
  19. public void Border(IContainer container)
  20. {
  21. container
  22. .Background("#EEE")
  23. .Padding(25)
  24. .AlignBottom()
  25. .AlignCenter()
  26. .BorderBottom(2)
  27. .BorderColor("#000")
  28. .Background("FFF")
  29. .Padding(5)
  30. .Text("Sample text", TextStyle.Default.FontType("Segoe UI emoji").Alignment(HorizontalAlignment.Center));
  31. }
  32. public void Alignment(IContainer container)
  33. {
  34. container
  35. .Stack(column =>
  36. {
  37. column
  38. .Element()
  39. .Height(100)
  40. .Background("#FFF")
  41. .AlignLeft()
  42. .AlignMiddle()
  43. .Width(50)
  44. .Height(50)
  45. .Background("#444");
  46. column
  47. .Element()
  48. .Height(100)
  49. .Background("#DDD")
  50. .AlignCenter()
  51. .AlignMiddle()
  52. .Width(50)
  53. .Height(50)
  54. .Background("#222");
  55. column
  56. .Element()
  57. .Height(100)
  58. .Background("#BBB")
  59. .AlignRight()
  60. .AlignMiddle()
  61. .Width(50)
  62. .Height(50)
  63. .Background("#000");
  64. });
  65. }
  66. public void Expand(IContainer container)
  67. {
  68. container
  69. .Stack(column =>
  70. {
  71. column
  72. .Element()
  73. .Height(150)
  74. .Row(row =>
  75. {
  76. row.RelativeColumn()
  77. .Extend()
  78. .Background("FFF")
  79. .Height(50)
  80. .Width(50)
  81. .Background("444");
  82. row.RelativeColumn()
  83. .Extend()
  84. .Background("BBB")
  85. .Height(50)
  86. .ExtendHorizontal()
  87. .Background("444");
  88. });
  89. column
  90. .Element()
  91. .Height(150)
  92. .Row(row =>
  93. {
  94. row.RelativeColumn()
  95. .Extend()
  96. .Background("BBB")
  97. .ExtendVertical()
  98. .Width(50)
  99. .Background("444");
  100. row.RelativeColumn()
  101. .Extend()
  102. .Background("BBB")
  103. .ExtendVertical()
  104. .ExtendHorizontal()
  105. .Background("444");
  106. });
  107. });
  108. }
  109. }
  110. }