printing in c#

printing list view in c#

Page 1 of 1

0 Replies - 1853 Views - Last Post: 09 September 2009 - 03:51 AM Rate Topic: -----

#1 shynidreamincode  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 09-September 09

printing in c#

Posted 09 September 2009 - 03:51 AM

hi,

I am trying to print the list view in c#. i have used the print function for that. But the output is not in the aligned format. How to align it.

My code is


 PrintDocument printDocObj=new PrintDocument(20,new Font("verdana",12),Color.Black);
			printDocObj.setStartPostion(20,455);
			string headerStr="";
			ListView printclockList=null;
			if(this.tabControl1.SelectedIndex==0)
			{
				printclockList=this.clockListView;
			}
			else
			{
				printclockList=this.changeClkListView;
			}
			for(int i=0;i<printclockList.Columns.Count;i++)
			{
				if(i==0)
				{
					headerStr=headerStr+"Sl no\t";
				}
				else
				{
					headerStr=headerStr+printclockList.Columns[i].Text+"\t";
				}
			}
			printDocObj.drawString(headerStr,g);
			currentClockView.ShowListView();
		   for(int i=0;i<printclockList.Items.Count;i++)
		   {
			   string colStr=""+(i+1)+"\t";
			   for(int j=0;j<printclockList.Items[i].SubItems.Count;j++)
			   {
				   colStr=colStr+printclockList.Items[i].SubItems[j].Text+"\t";
			   }
			   printDocObj.drawString(colStr,g);
		   }




Is This A Good Question/Topic? 0
  • +

Page 1 of 1