[RESOLVED] Printing an image
I have a form with many controls and in the top left I have an image. I have added a printdialog and print document. I have the code below in my PrintPage. The textbox's print fine but the images do not get printed and I get no error. You will see several attempts at different ways to print an image. Feel free to correct me on any of them.
Code:
private void mDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
float xPos = e.MarginBounds.Left;
float yPos = e.MarginBounds.Top;
float lineHeight = mFont.GetHeight(e.Graphics);
if (varDef == 0)
{
{
//Bitmap bitmap = new Bitmap("M:\\Apps\\DocCtrl\\Graphics\\DNDFlag.gif");
//e.Graphics.DrawImage(bitmap, 20, 30);
e.Graphics.DrawString(txtEng.Text, mFont2, Brushes.Black, xPos, yPos);
Image imageFile = Image.FromFile("M:\\Apps\\DocCtrl\\Graphics\\DNDFlag2.gif");
Graphics newgraphics = Graphics.FromImage(imageFile);
e.Graphics.DrawImage(imageFile, new Point(Convert.ToInt16(xPos), Convert.ToInt16(yPos)));
newgraphics.Dispose();
e.Graphics.DrawImage(Image.FromFile("M:\\Apps\\Resource Management\\loanflag3.jpg"), xPos, yPos);
yPos += lineHeight;
yPos += lineHeight;
e.Graphics.DrawString(textBox2.Text, mFont2, Brushes.Black, xPos, yPos);
yPos += lineHeight;
yPos += lineHeight;
}
Problem solved, I had 2 methods and the one I was edditting was the wrong one. DUH./
Re: [RESOLVED] Printing an image
Hang on a minute, you are not supposed to solve it before I have finished typing a reply! :D