JACOBMAHONE
-
14 sept. 2018 à 21:37
Whismeril
Messages postés18806Date d'inscriptionmardi 11 mars 2003StatutContributeurDernière intervention 8 décembre 2023
-
17 sept. 2018 à 23:05
Bonjour,
je desire imprimer sur la meme page FORMAT A4 une image et un datagridview.
en effet je veux imprimer l'image en haut du datagriview imprimer voici mon code:
ça n'imprime rien du tout
try
{
printDialog1.Document = printDocument1;
if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.Print();
DGVPrinter printer = new DGVPrinter();
printer.Title = "REPUBLIQUE ;
printer.SubTitleFormatFlags = StringFormatFlags.LineLimit |
StringFormatFlags.NoClip;
printer.PageNumbers = true;
printer.PageNumberInHeader = false;
printer.ColumnWidth = DGVPrinter.ColumnWidthSetting.Porportional;
printer.HeaderCellAlignment = StringAlignment.Near;
printer.Footer = "--------------------";
printer.FooterSpacing = 15;
printer.PrintDataGridView(dataGridView1);
}
}
catch(Exception)
{
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Image newImage = Image.FromFile("C:\rose.JPG");
int x = 100;
int y = 100;
int width = 450;
int height = 150;
e.Graphics.DrawImage(newImage, x, y, width, height);
}