Question Print captured image in center of page

gaului

New member
Joined
Jun 4, 2013
Messages
1
Programming Experience
Beginner
Hi,

The below code is working fine on my laptop. But when I run it on my desktop, the image is not in the center. I think it would be screen solution. How can I fix to get the captured image in the center of page for all screen solution?

It is really appreciated for any suggestion


[XCODE]
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawImage(memoryImage,90,80);
}

private void btnPrint_Click(object sender, EventArgs e)
{

Size size = new Size(this.Size.Width - planView1.gbxChooseYourDoor.ClientSize.Width-100, this.Size.Height 30-10);
Point point = new Point(this.Location.X + 10, this.Location.Y + 30);
//Size size = new Size(this.Size.Width + 200, this.Size.Height);
memoryImage = ImageHelper.CaptureScreen(this.CreateGraphics(), size, point);
memoryImage.Save(fileName);
printDialog1.Document = printDocument1;

DialogResult res = printDialog1.ShowDialog();
if (res == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Margins = new Margins(100, 100, 100, 100);
printDocument1.OriginAtMargins = false;
printDocument1.DefaultPageSettings.Landscape=true;
printDocument1.Print();
}
}
[/XCODE]
 
Top Bottom