Bonjours,

Je vous soumet mon code car je comprend pas pourquoi je ne suis pas capable imprimer sur 2 pages. il imprime la 2ieme page par dessus la 1 ière page. Pourquoi?
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
private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) 
		 {
			Pen^ blackPen = gcnew Pen( Color::Black,1.0f );
			System::Drawing::Font ^FT1 = gcnew System::Drawing::Font( this->Font,FontStyle::Bold );
			System::Drawing::Font ^FT2 = gcnew System::Drawing::Font( this->Font,FontStyle::Regular );
			int TabPage = tabControl1->SelectedIndex;
			array<Control ^> ^dataGridViewATrouver = tabControl1->Controls->Find(String::Format("dataGridView{0}",TabPage), true);
			DataGridView ^DGV = safe_cast<DataGridView^>(dataGridViewATrouver[0]);
			int Rows = DGV->RowCount;
			e->Graphics->DrawString("Inventaire "+tabControl1->TabPages[TabPage]->Text,label33->Font,Brushes::Black,float::Parse((300).ToString()),float::Parse((2).ToString()));
			e->Graphics->DrawString("Code ",FT1,Brushes::Black,float::Parse((17).ToString()),float::Parse((40).ToString()));
			e->Graphics->DrawString("CUP",FT1,Brushes::Black,float::Parse((134).ToString()),float::Parse((40).ToString()));
			e->Graphics->DrawString("Description de l'article",FT1,Brushes::Black,float::Parse((362).ToString()),float::Parse((40).ToString()));
			e->Graphics->DrawString("Quantitées",FT1,Brushes::Black,float::Parse((717).ToString()),float::Parse((40).ToString()));
			Rectangle rect1 = Rectangle(1,39,100,14);
			Rectangle rect2 = Rectangle(101,39,100,14);
			Rectangle rect3 = Rectangle(201,39,500,14);
			Rectangle rect4 = Rectangle(701,39,100,14);
			e->Graphics->DrawRectangle( blackPen, rect1 );
			e->Graphics->DrawRectangle( blackPen, rect2 );
			e->Graphics->DrawRectangle( blackPen, rect3 );
			e->Graphics->DrawRectangle( blackPen, rect4 );
			int y = 0;
			int EmpY = 0;
			for (int i=0; i<Rows; i++)
			{
				if ( EmpY > 1050)
				{
					e->HasMorePages = true;
					y =0;
					EmpY = 0;
					e->Graphics->DrawString("Inventaire "+tabControl1->TabPages[TabPage]->Text,label33->Font,Brushes::Black,float::Parse((300).ToString()),float::Parse((2).ToString()));
					e->Graphics->DrawString("Code ",FT1,Brushes::Black,float::Parse((17).ToString()),float::Parse((40).ToString()));
					e->Graphics->DrawString("CUP",FT1,Brushes::Black,float::Parse((134).ToString()),float::Parse((40).ToString()));
					e->Graphics->DrawString("Description de l'article",FT1,Brushes::Black,float::Parse((362).ToString()),float::Parse((40).ToString()));
					e->Graphics->DrawString("Quantitées",FT1,Brushes::Black,float::Parse((717).ToString()),float::Parse((40).ToString()));
					Rectangle rect1 = Rectangle(1,39,100,14);
					Rectangle rect2 = Rectangle(101,39,100,14);
					Rectangle rect3 = Rectangle(201,39,500,14);
					Rectangle rect4 = Rectangle(701,39,100,14);
					e->Graphics->DrawRectangle( blackPen, rect1 );
					e->Graphics->DrawRectangle( blackPen, rect2 );
					e->Graphics->DrawRectangle( blackPen, rect3 );
					e->Graphics->DrawRectangle( blackPen, rect4 );
				}
				else e->HasMorePages = false;
				DataGridViewRow ^row = DGV->Rows[i];
				e->Graphics->DrawString(Convert::ToString(row->Cells[0]->Value),FT2,Brushes::Black,float::Parse((2).ToString()),float::Parse((y*14+54).ToString()));
				e->Graphics->DrawString(Convert::ToString(row->Cells[1]->Value),FT2,Brushes::Black,float::Parse((102).ToString()),float::Parse((y*14+54).ToString()));
				e->Graphics->DrawString(Convert::ToString(row->Cells[2]->Value),FT2,Brushes::Black,float::Parse((202).ToString()),float::Parse((y*14+54).ToString()));
				e->Graphics->DrawString(Convert::ToString(row->Cells[3]->Value),FT2,Brushes::Black,float::Parse((702).ToString()),float::Parse((y*14+54).ToString()));
				rect1 = Rectangle(1,y*14+53,100,14);
				rect2 = Rectangle(101,y*14+53,100,14);
				rect3 = Rectangle(201,y*14+53,500,14);
				rect4 = Rectangle(701,y*14+53,100,14);
				e->Graphics->DrawRectangle( blackPen, rect1 );
				e->Graphics->DrawRectangle( blackPen, rect2 );
				e->Graphics->DrawRectangle( blackPen, rect3 );
				e->Graphics->DrawRectangle( blackPen, rect4 );
				EmpY = y*14+54;
				y++;
			}
 
 
		}
Merci pour votre aide