Windows Develop Bookmark and Share   
 index > Windows Forms Sample Applications > printing textbox in a customize paper size
 

printing textbox in a customize paper size

hi
im using vb2005 & a newbee

HOw to print my textbox.text value to a specific portion of the paper
especially a 3.75 inches X 9.5 inches paper..


my first problem is to customize this kind of paper
and to print a textbox to specific location..


another question is :
if a user will try to print in a suggested number of paper

is looping method or not..

do you any sample code for that

....thnx.....


VBras  Monday, March 16, 2009 9:58 AM

Hi VBras,

> my first problem is to customize this kind of paper

See my reply in the following post on how to use a custom paper size when printing:
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/47d9f008380b5350/cbe5435e338e984c?q=v-lliu+print+custom+paper+size

> and to print a textbox to specific location..

When calling the Graphics.DrawString method,use theforth parameter to specify the upper-left corner of the drawn text. For example:
e.DrawString("this is a test", Me.Font, Brushes.Black, new PointF(200,300))

> if a user will try to print in a suggested number of paper

Do you mean that the user may want to print a range of pages, e.g.there're 10 pages total and the user only wants to print pages from No.4 to No.6?

You can use a variable to count the number of page that is to be printed in the PrintPage event handler of the PrintDocument. If the page number falls within the secified range, print it out; otherwise, just skip the printing.

For more information on how to print using PrintDocument class, refer to the following sample:
"How to: Print a Multi-Page Text File in Windows Forms"
http://msdn.microsoft.com/en-us/library/cwbe712d.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu

Linda Liu  Thursday, March 19, 2009 7:49 AM

Hi VBras,

> my first problem is to customize this kind of paper

See my reply in the following post on how to use a custom paper size when printing:
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/47d9f008380b5350/cbe5435e338e984c?q=v-lliu+print+custom+paper+size

> and to print a textbox to specific location..

When calling the Graphics.DrawString method,use theforth parameter to specify the upper-left corner of the drawn text. For example:
e.DrawString("this is a test", Me.Font, Brushes.Black, new PointF(200,300))

> if a user will try to print in a suggested number of paper

Do you mean that the user may want to print a range of pages, e.g.there're 10 pages total and the user only wants to print pages from No.4 to No.6?

You can use a variable to count the number of page that is to be printed in the PrintPage event handler of the PrintDocument. If the page number falls within the secified range, print it out; otherwise, just skip the printing.

For more information on how to print using PrintDocument class, refer to the following sample:
"How to: Print a Multi-Page Text File in Windows Forms"
http://msdn.microsoft.com/en-us/library/cwbe712d.aspx

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu

Linda Liu  Thursday, March 19, 2009 7:49 AM

You can use google to search for other answers

Custom Search

More Threads

• New 1.1 version?
• Auto-Updating DataBindings
• When will the next version of terrarium be released?
• Can't load the Deer.dll to Terrarium game
• Panel Control
• Open source version?
• TaskVision Websevice Problem Cache
• WindowsApllications In Multithreading
• Windows Explorer Auto Refreshing
• Install Error