Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Printing

Printing

Scheduled Pinned Locked Moved C#
graphicsdocker
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jerry Hammond
    wrote on last edited by
    #1

    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.

    C 1 Reply Last reply
    0
    • J Jerry Hammond

      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.

      C Offline
      C Offline
      cmaissan
      wrote on last edited by
      #2

      Maybe it is printing outside the margins of the page. Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location); -Chris

      J 1 Reply Last reply
      0
      • C cmaissan

        Maybe it is printing outside the margins of the page. Try: e.Graphics.DrawString(txtText.Text, fnt, Brushes.Black, e.MarginBounds.Location); -Chris

        J Offline
        J Offline
        Jerry Hammond
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups