C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Printing contents of controls in .Net


Posted Date: 02 Sep 2008    Resource Type: Articles    Category: Web Applications

Posted By: Srinivas        Member Level: Gold
Rating:     Points: 5




In some situations we need to print only the contents of the controls

Using the following code we can print the contents of the contorls.

for eg say we have a label and textbox and we need to print the values of the controsl



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);
}






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Vb.net  .  Printing  .  Controls  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: DropdownList's selected text into TextBox
Previous Resource: DataReader vs. DataSet
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

it help desk

Contact Us    Privacy Policy    Terms Of Use