Bonjour,
je souhaiterais savoir comment imprimer sur plusieurs pages une ListBox ??
voilà le code que j'ai fait mais il n'imprime que sur une seule page donc si la ListBox contient trop d'éléments ca ne va pas.
merci d'avance pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 if (print == true) { double height = 0; StackPanel _stck = new StackPanel(); _stck.HorizontalAlignment = HorizontalAlignment.Center; Rectangle a = new Rectangle(); a.Width = 530; a.Height = 300; a.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); a.Fill = new VisualBrush(this.stckHeader as Visual); //a.Stretch = Stretch.UniformToFill; Size sizeGrid = a.DesiredSize; Point ptGrid = new Point(0, height); a.Arrange(new Rect(ptGrid, sizeGrid)); _stck.Children.Add(a); height += a.Height; PageContent _pc = new PageContent(); for (int i = 0; i < Liste.Items.Count; i++) { // OffreProductItem -> UserControl OffreProductItem _opi = (Liste.Items[i] as OffreProductItem); a = new Rectangle(); a.Width = 500; a.Height = 175; a.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); a.Fill = new VisualBrush(_opi as Visual); sizeGrid = a.DesiredSize; Point ptgrid2 = new Point(0, height); a.Arrange(new Rect(ptgrid2, sizeGrid)); _stck.Children.Add(a); height += a.Height; } pDialog.PrintVisual(_stck as Visual, "impression"); }
Partager