Printing
-
This snippet activates the paper feed but does not result in any printed text.
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Printing; namespace _316CH11 { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox txtText; private System.Windows.Forms.Button btnPrint; private System.Drawing.Printing.PrintDocument printDocument1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.txtText = new System.Windows.Forms.TextBox(); this.btnPrint = new System.Windows.Forms.Button(); this.printDocument1 = new System.Drawing.Printing.PrintDocument(); this.SuspendLayout(); // // txtText // this.txtText.Location = new System.Drawing.Point(0, 0); this.txtText.Multiline = true; this.txtText.Name = "txtText"; this.txtText.Size = new System.Drawing.Size(176, 125); this.txtText.TabIndex = 0; this.txtText.Text = ""; // // btnPrint // this.btnPrint.Location = new System.Drawing.Point(0, 136); this.btnPrint.Name = "btnPrint"; this.btnPrint.Size = new System.Drawing.Size(176, 23); this.btnPrint.TabIndex = 1; this.btnPrint.Text = "&Print"; this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); // // printDocument1 // this.printDocument1.DocumentName = "NetDocument11-1"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 262); this.Controls.Add(this.btnPrint); this.Controls.Add(this.
-
This snippet activates the paper feed but does not result in any printed text.
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Printing; namespace _316CH11 { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox txtText; private System.Windows.Forms.Button btnPrint; private System.Drawing.Printing.PrintDocument printDocument1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.txtText = new System.Windows.Forms.TextBox(); this.btnPrint = new System.Windows.Forms.Button(); this.printDocument1 = new System.Drawing.Printing.PrintDocument(); this.SuspendLayout(); // // txtText // this.txtText.Location = new System.Drawing.Point(0, 0); this.txtText.Multiline = true; this.txtText.Name = "txtText"; this.txtText.Size = new System.Drawing.Size(176, 125); this.txtText.TabIndex = 0; this.txtText.Text = ""; // // btnPrint // this.btnPrint.Location = new System.Drawing.Point(0, 136); this.btnPrint.Name = "btnPrint"; this.btnPrint.Size = new System.Drawing.Size(176, 23); this.btnPrint.TabIndex = 1; this.btnPrint.Text = "&Print"; this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click); // // printDocument1 // this.printDocument1.DocumentName = "NetDocument11-1"; // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(292, 262); this.Controls.Add(this.btnPrint); this.Controls.Add(this.
-
Maybe it is printing outside the margins of the page. Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location); -Chris
cmaissan wrote: Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location); No joy. Tried it and get the same behavior. Thank you for the suggestion. Jerry Most people are willing to pay more to be amused than to be educated--Robert C. Savage, Life Lessons Toasty0.com Ladder League (beta) My Grandkids