Просмотр исходного кода

Added simpler overflow example

Marcin Ziąbek 2 лет назад
Родитель
Сommit
982105d221
1 измененных файлов с 27 добавлено и 0 удалено
  1. 27 0
      Source/QuestPDF.Examples/ElementExamples.cs

+ 27 - 0
Source/QuestPDF.Examples/ElementExamples.cs

@@ -896,6 +896,33 @@ namespace QuestPDF.Examples
                 });
         }
         
+        [Test]
+        public void DrawOverflowSimpleExample()
+        {
+            var image = Placeholders.Image(400, 300);
+            
+            RenderingTest
+                .Create()
+                .ShowResults()
+                .PageSize(PageSizes.A4)
+                .ProducePdf()
+                .Render(container =>
+                {
+                    container
+                        .Padding(24)
+
+                        // constrain area to square 200 x 200
+                        .Width(200)
+                        .Height(200)
+                        .Background(Colors.Grey.Lighten3)
+
+                        // draw image that fits height (and therefore will overflow)
+                        .ContentOverflowDebugArea()
+                        .Image(image)
+                        .FitHeight();
+                });
+        }
+        
         [Test]
         public void DrawOverflowCases()
         {