Voici comment imprimer une form avec PrintDocument.
Voici comment faire. ca imprime seulement la capture de l'écran qui est active.
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 private: System::Void imprimerToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) //bouton imprimer que vous avez créé dans la form { CaptureScreen(); printPreviewDialog1->ShowDialog(); } Bitmap ^memoryImage; private: void CaptureScreen()// Capture l'écran { Graphics ^myGraphics = this->CreateGraphics(); memoryImage = gcnew Bitmap(Size.Width, Size.Height, myGraphics); Graphics ^memoryGraphics = Graphics::FromImage(memoryImage); memoryGraphics->CopyFromScreen(this->Location.X, this->Location.Y, 0, 0, Size); } private: System::Void printDocument1_PrintPage(System::Object ^ sender,System::Drawing::Printing::PrintPageEventArgs ^ e)//printDocument que vous aurez ajouter dans votre form avec la boite a outils dans la section impression { e->Graphics->DrawImage(memoryImage, 0, 0); }
TrollTop c++.net
Si vous connaisser la façons de faire pour imprimer vraiement la form au complet pas en faissant une capture screen. S.V.P envoyer moi comment faire. Merci







Répondre avec citation





Partager