Salut tout le monde,

je développe une petite application qui permet de gérer les achats d'un client.
j'utilise une List<Client> pour imprimer des information sur les client, tout vas bien juste que j'ai un champs dans ma Class Client qui contient Beaucoup de caracteres et a l'impression j'ai un dépassement de la marge sans retour a la linge (donc tout ne s'affiche pas ).

je voulais savoir s'il y a une fonction ou une technique qui permet de gérer mon String et avoir un retour en ligne une fois quand atteint la marge.
voici une aprtie de mon code que j'utilise pour l'impression
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  private void prDoc_PrintPage(object sender, PrintPageEventArgs e)
        {
            int height = 0;
 
            // Draw the title
            if (this._currentPrintPage == 1)
            {
                this.PrintTitle(e.Graphics, e.MarginBounds);
                height += 120;
 
 
            }
            // Draw the comments
            if (this._printAction == PrintAction.PrintToPreview && this._comment) this.PrintComment(e);
            // Create the printer
            PersonPrinter personPrint = new PersonPrinter(new Font("Arial", 12), e.Graphics);
            // Print each person
            for (int i = this._personCounter; i < this._persons.Count; i++)
            {
                personPrint.Draw(++this._personCounter, this._persons[i], new Point(50, height));
                height += 120;
                // The page is full, go to the next one
                if (height + 120 > e.MarginBounds.Height) break;
 
            }
 
            // Check if there is some elements to prints
            if (this._personCounter >= this._persons.Count) e.HasMorePages = false;
            else
            {
                e.HasMorePages = true;
                this._currentPrintPage++;
                if (this._maxPage < this._currentPrintPage) this._maxPage = this._currentPrintPage;
            }
        }
 private class PersonPrinter
        {
            private Font _font = null;
            private Graphics _gfx = null;
            private Point _point = Point.Empty;
            private Brush _brush = Brushes.Black;
 
            /// -------------------------------------------------------------------------
            /// <summary>
            /// Create a new PersonPrinter object.
            /// </summary>
            /// <param name="font"> The font to use. </param>
            /// <param name="gfx"> The current graphic context. </param>
            /// -------------------------------------------------------------------------
            public PersonPrinter(Font font, Graphics gfx)
            {
                this._font = font;
                this._gfx = gfx;
            }
 
            /// -------------------------------------------------------------------------
            /// <summary>
            /// Draw a person.
            /// </summary>
            /// <param name="nb"> The person n°. </param>
            /// <param name="person"> The person. </param>
            /// <param name="start"> The starting location to draw. </param>
            /// -------------------------------------------------------------------------
            public void Draw(int nb, Client1.Client person, Point start)
            {
 
 
 
 
                // New point reference
                this._point = start;
                this._brush = person.id == 0 ? Brushes.Red : Brushes.Black;
                const char subChar = (char)7;
 
                // Draw
                this.DrawSub(string.Format("{0}* Nom: {1}", subChar, person.FirstName), 0);
 
                this.DrawSub(string.Format("{0}* Prénom: {1}", subChar, person.LastName), 1);
                this.DrawSub(string.Format("{0}  Tel: {1} ", subChar, person.tel), 2);
                //this.DrawSub(string.Format("{0}  Description: {1} ", subChar, person.Description), 3);
                this.DrawSub(string.Format("{0}  Description: {1} ", subChar,person.Description), 3);
            }
 
            /// -------------------------------------------------------------------------
            /// <summary>
            /// Draw a person.
            /// </summary>
            /// <param name="txt"> The text to draw. </param>
            /// <param name="lign"> The lign. </param>
            /// -------------------------------------------------------------------------
 
 
 
 
            private void DrawSub(string txt, int lign)
            {
 
 
 
                int x = lign == 0 ? this._point.X : this._point.X + 0;
                this._gfx.DrawString(txt, this._font, this._brush, x, this._point.Y + (lign * 35));
            }
        }
Merci d'avance pour votre aide.