473,405 Members | 2,379 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,405 software developers and data experts.

Trying to create a nethod to autosize a font when printing

Hi;

I'm trying to create a method that will figure out the size of a font based
on the data that is to printed to the page. i will be printing a tabular
report where it's all based on two rectangles the first on will contain a
three char word and the second cell will have up to 44 characters. there will
be X number of these pairings horizontally. Since i don't want the cells to
vary in width i did the calculations based on a width of 44 chars. my
caluclations looked some thing like this:

myFont = new Font("Arial",10);
FontWidth = Convert.ToInt32(myG.MeasureString("h",myFont).Widt h);
count = 6; //number of column pairs
MaxStringLength = 44;
WidthCell1=3;

MaxWidth = (WidthCell1 + MaxStringLength )*count*FontWidth ;

how ever when i draw the cells around the two strings the both have extra
space. much more than the string length any ideas?

Nov 17 '05 #1
0 1191

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

Similar topics

21
by: James Moe | last post by:
Hello, I just joined this group and saw the discussion "What do you think of resizing 1em to 10px?" I am somewhat confused by what y'all think should be used as a reference size. I was surprised...
1
by: intl04 | last post by:
I am getting strange print-related error messages when trying to create (not print!) reports. For example, when I click 'new' to create a report then choose 'design view', I get an error message...
0
by: Shawn | last post by:
Hi; I'm trying to create a method that will figure out the size of a font based on the data that is to printed to the page. i will be printing a tabular report where it's all based on two...
2
by: VBTricks.de.vu Webmaster | last post by:
Hello, I'm still reimplementing the GUI of my app using the new toolstrips. My current problem is to autosize a combobox to the available with in the parent toolstrip. There are some buttons...
8
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False...
3
by: Theo Verweij | last post by:
I am using a font to display in textboxes, labels and use it to print using the printdocument. When the "Enable Application Framework" option is disabled, the font works only in a textbox; in a...
4
by: DeWittds | last post by:
Had no luck in the visual basic group maybe someone here can give me a hand. I have been tring to recreate a simple program that I wrote many years ago in quick basic. The program get name and...
2
by: =?Utf-8?B?Qm9i?= | last post by:
In VB.Net 2003 and previous versions new labels were created with AutoSize=False. In VB.Net 2005, new labels are created with AutoSize=True. Why was it changed? Is there somewhere in VB.Net 2005...
3
by: =?Utf-8?B?ZGFycmVu?= | last post by:
i need to autosize a label to grow with the size of the text that from a database how do i do this? i have tried to uses MeasureString but i don't have the right parameters namely the font...
0
by: Linda Liu[MSFT] | last post by:
Hi Al, Based on my understanding, you have an application which prints something to printers. The problem is that the font of "OCR A Extended" cannot be printed properly on some of printers. If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.