Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-18-2006, 11:07 AM
Chan Chan is offline
Programming Professional
 
Join Date: Jun 2006
Posts: 204
Rep Power: 10
Chan is on a distinguished road
Default Printing

In addition to my barcodes thread at: http://forum.codecall.net/c/897-barcodes.html

I also need to print these barcodes. Is there a built-in .NET class that allows me to print? Or will I have to create my own connection to the printer?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-18-2006, 01:19 PM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default

http://www.c-sharpcorner.com/Code/20...CodingInCS.asp
--this article has a good article for barcodes

http://www.c-sharpcorner.com/winforms/texteditor.asp
--this has small demo of how to print the contents of a textbox in C#

Hope this stuff helps out!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-19-2006, 05:44 PM
Ronin Ronin is offline
Programming Professional
 
Join Date: Apr 2006
Posts: 299
Rep Power: 10
Ronin is on a distinguished road
Default

Yes, there are tons of tutorials out there for printing from C#. You can find just about anything in C# if you search for it....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-01-2006, 11:59 AM
Blaze's Avatar   
Blaze Blaze is offline
Programmer
 
Join Date: Jun 2006
Posts: 117
Rep Power: 9
Blaze is on a distinguished road
Default

Printing from C# is very easy. Here is an example:

At top:
Code:
using System.Drawing.Printing;
Print Function:
Code:
		public void Print()
		{
			PrintDocument tmpprndoc = new PrintDocument();
			tmpprndoc.PrintPage += new PrintPageEventHandler(toPrinter);

            // Load some variables
            System.Windows.Forms.PrintDialog printDialog1 = new System.Windows.Forms.PrintDialog();


            // Load the print dialog
            if(printDialog1.ShowDialog() == DialogResult.OK) 
            {

                // Change the default printer
                tmpprndoc.PrinterSettings.PrinterName = printDialog1.PrinterSettings.PrinterName;

                // Change orientation
                tmpprndoc.PrinterSettings = printDialog1.PrinterSettings;

                // Find our DPI Size (or pixels per inch)
                GetDPISize();

                // Print the document
	    		tmpprndoc.Print();

          }

}
What to print:
Code:
		private void toPrinter(Object sender, PrintPageEventArgs e)
		{
         // Create our graphics object
	Graphics g = e.Graphics;

            // Set the color of our object
	 Brush br = new SolidBrush(Color.Black);

 g.DrawString("Test Here", m_PrintFont, br, 5,5);
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript:Tutorial, Printing a Webpage TcM Javascript 6 06-07-2008 01:07 PM
printing out into notepad from the html using perl lichy Perl 8 12-14-2007 01:06 PM
.NET problem with printing a barcode honzac32 C# Programming 3 07-10-2007 03:41 PM


All times are GMT -5. The time now is 09:23 AM.

Contest Stats

Xav ........ 162.68
Sacback ........ 120.05
alearb8 ........ 120.05
tfusion ........ 120
amr2107 ........ 120
d3s!gn ........ 120
Qoolman21 ........ 120
Pillager ........ 108
antihero ........ 106
donfrench ........ 100.05

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 68%

Ads