In addition to my barcodes thread at: http://forum.codecal...7-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?
Printing
Started by Chan, Aug 18 2006 08:07 AM
3 replies to this topic
#1
Posted 18 August 2006 - 08:07 AM
|
|
|
#2
Posted 18 August 2006 - 10:19 AM
http://www.c-sharpco...rCodingInCS.asp
--this article has a good article for barcodes
http://www.c-sharpco.../texteditor.asp
--this has small demo of how to print the contents of a textbox in C#
Hope this stuff helps out!
--this article has a good article for barcodes
http://www.c-sharpco.../texteditor.asp
--this has small demo of how to print the contents of a textbox in C#
Hope this stuff helps out!
#3
Posted 19 August 2006 - 02:44 PM
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....
#4
Posted 01 September 2006 - 08:59 AM
Printing from C# is very easy. Here is an example:
At top:
Print Function:
What to print:
At top:
using System.Drawing.Printing;
Print Function:
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:
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);


Sign In
Create Account


Back to top









