print datagridview and another image on same page

  • Thread starter Thread starter jacob mahone
  • Start date Start date
J

jacob mahone

Guest
Hello dear Friends
I desire to print on the same page an image and a DataGridView. Indeed I want to print the image at the top of the DataGridView. The image is not part of the DataGridView.





try

{


printDialog1.Document = printDocument1;

if (printDialog1.ShowDialog()== DialogResult.OK)


{

printDocument1.Print();
DGVPrinterprinter = 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)

{

ImagenewImage = 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);

}
But the code does not meet my needs

Continue reading...
 
Back
Top