How do I print the contents of a TextBox in metro apps? I have read this quickstart guide on MSDN and many online tutorials, but they are very complicated and do not
I just created a small winforms-application with a textbox (textBox1) and a button (button1). The code-behind looks like:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void PrintDocumentOnPrintPage(object sender, PrintPageEventArgs e)
{
e.Graphics.DrawString(this.textBox1.Text, this.textBox1.Font, Brushes.Black, 10, 25);
}
private void button1_Click(object sender, EventArgs e)
{
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += PrintDocumentOnPrintPage;
printDocument.Print();
}
}
On a click on the button the printing will be done.