Hi
My code is here to print string value in PrintPreviewDialog window
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Printing;
namespace TemplatePrintPreview
{
public partial class Form1 : Form
{
private PrintPreviewDialog printPreviewDialog1 = new PrintPreviewDialog();
private PrintDocument printDocument1 = new PrintDocument();
public Form1()
{
InitializeComponent();
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
{
StringFormat fieldStringFormat = new StringFormat(StringFormat.GenericTypographic);
fieldStringFormat.Alignment = StringAlignment.Far;
e.Graphics.DrawString("'StringFormat.GenericTypographic' is working fine in x86, Not working in x64", new Font("arial", 12), Brushes.Red, new RectangleF(900, 300, -200, 20), fieldStringFormat);
}
private void Form1_Load(object sender, EventArgs e)
{
printDocument1.PrintPage += new PrintPageEventHandler(pd_PrintPage);
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
this.Close();
}
}
}
When the application is run under Platorm traget 'x86' or 'any cpu' it is printing string field in PrintPreview window, but when i set Platform target to 'x64' (Project Properties->Build->Platform target) it does not print any thing in PrintPreview window.
I am working on VS2012 IDE, 4.5 .net Framework, Windows 7 Professional SP1 64 bit OS.
Thanks,
Kota.