473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Printing Question

Hi

I know I can use the GetHeight of the Font object to figure out how many
lines will fit into a page, but how can I find out how many characters will
fit into a line

Thank you,
S. Shulman
Nov 2 '05 #1
2 1077
For a fixed-width font, ex. Courier New, you can get the width of a letter
and check that against your margin area. For a proportional font the only
way I know would be to keep adding words to a string and then check the
width using MeasureString. If you just want to wrap paragraphs into an area
you can use a DrawString overload that takes a rectangle to print in. You
can use a MeasureString overload with the same rectangle to get back the #
of lines generated in the rectangle and the # of characters used from the
string. Then draw the string if everything fits and advance your start
point by the # of lines returned.
All this is a bit oversimplified but it will work for simple text
fitting. For more information you should probably look in
microsoft.public.dotnet.framework.drawing.

Ron Allen
"S Shulman" <sm*******@hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Hi

I know I can use the GetHeight of the Font object to figure out how many
lines will fit into a page, but how can I find out how many characters
will fit into a line

Thank you,
S. Shulman

Nov 2 '05 #2
Thank you

Shmuel

"Ron Allen" <rallen@_nospam_src-us.com> wrote in message
news:Ok**************@TK2MSFTNGP09.phx.gbl...
For a fixed-width font, ex. Courier New, you can get the width of a letter
and check that against your margin area. For a proportional font the only
way I know would be to keep adding words to a string and then check the
width using MeasureString. If you just want to wrap paragraphs into an
area you can use a DrawString overload that takes a rectangle to print in.
You can use a MeasureString overload with the same rectangle to get back
the # of lines generated in the rectangle and the # of characters used
from the string. Then draw the string if everything fits and advance your
start point by the # of lines returned.
All this is a bit oversimplified but it will work for simple text
fitting. For more information you should probably look in
microsoft.public.dotnet.framework.drawing.

Ron Allen
"S Shulman" <sm*******@hotmail.com> wrote in message
news:OP**************@TK2MSFTNGP09.phx.gbl...
Hi

I know I can use the GetHeight of the Font object to figure out how many
lines will fit into a page, but how can I find out how many characters
will fit into a line

Thank you,
S. Shulman


Nov 2 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David Isaac | last post by:
I'd like to try personal financial management using Python. I just found PyCheckbook, but it does not support check printing. Is there a Python check printing application kicking around? Thanks,...
8
by: David Isaac | last post by:
"Alan Isaac" <aisaac0@verizon.net> wrote in message news:_A34e.2207$1r6.248@trnddc02... > I'd like to try personal financial management using Python. > I just found PyCheckbook, but it does not...
1
by: Dave | last post by:
Hi, Can anyone direct me to any articles on the best way to give a print option in VB & ASP .net Cheers
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
2
by: gerb | last post by:
Hello, I realise this is not a pure Javascript question, and that VBscript is probably involved at some point, though not as much as I fear. If you opened this item looking for a pute Javascript...
3
by: Mika M | last post by:
Hi all! I have made an application for printing simple barcode labels using PrintDocument object, and it's working fine. Barcode printer that I use is attached to the computer, and this...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
10
by: Mtek | last post by:
Hi, I have a web page with some drop downs. Once the user makes his selections the bottom half of the page is populated. When that happens, I want to create a formatted report in a hidden div....
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.