.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> .Net Framework >> Post New Resource Bookmark and Share   

 Subscribe to Articles

print the values of the controls in .NET

Posted By:Shashi Ray       Posted Date: September 02, 2008    Points: 15    Category: .Net Framework    URL: http://www.dotnetspark.com  
 

 

 


using System.Drawing.Printing;
using System.Drawing;

private void button1_Click(object sender, EventArgs e)
        {
PrintDocument demodoc = new PrintDocument();
            PrintPreviewDialog printprvdialog = new PrintPreviewDialog();
            demodoc.PrintPage += new PrintPageEventHandler(printevent);
            printprvdialog.Document = demodoc;
            printprvdialog.ShowDialog();
        }



private void printevent(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawString(label1.Text, new Font("Arail",10,FontStyle.Bold), Brushes.Black, 100,200);
            e.Graphics.DrawString(textBox1.Text, new Font("Arail", 10, FontStyle.Bold), Brushes.Black, 150, 300);
        }
 

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend