Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Font Sizes To Paper Size?


Hello,

I'm trying to get this printing code finished and ran into the problem of how many rows to count on an 8 1/2" x 11" paper size with various font sizes. ie, how many rows does it take a font size of 8 to fill a the paper?
Is there a chart or something somewhere that shows these ratios of other font sizes and paper sizes?
Also, I'd like to know if the screen resolution has anything to do with the font sizes printed onto the paper if I'm using the Print Object Methods and Properties? Or do I just have my plans here completely wrong and am not doing this correctly?

Thanks again guys.Kind Regards,
Drumsticks




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Set Paper Sizes
I need to set the paper size of a printer. Right now I'm able to get a list of the paper sizes available using the DeviceCapabilities api, however I have not found a way to set one of these paper sizes as the current paper size.

I am aware of the printer object, I think I need more flexibility than what is offered as far as setting paper sizes. I'm dealing with printers that may have several paper names for the same size, as an example if I want to set a "D" size sheet current, there may be several paper names such as "ANSI D", "ISO D", etc...

I would like to be able to select a paper size by its name but I'm open to any suggestions that might work.

Thanks.

List Available Paper Sizes
Does anyone have sample code to list the paper sizes that are available from the printer object. I can list the available printers from the printers object and the default or current paper sizes but not all the options

C

Changing Paper Sizes. Please Help.
Hello,
I need to print from vb with different custom paper sizes and nothing seems to work.

Is this a bug in VB?
How can I make it work or where can I find more information on this?

Any help will be highly appreciated.

Many thanks

Load Font Sizes Depending On Selected Font
I have lokked and looked for thi sbut cant find anything about it. I want to be able to select a font from a combo box and have the correct font size apper within another combo box to choose from. How do I go about loading the proper font sizes for the fonts.

Paper Sizes Available For A Printer In Access
I'm setting up a print settings form for reports in Access because I will be having several people using my program and I don't want the changes that one person makes to affect the program itself.

I've got everything except for the paper sizes available for the printer.

How is this normally handled? Access has a lit of paper size constants. Do people normally just display all of them (with their string equivalent, of course)?

If not, can I get the sizes available for a printer directly from Access or will I need to use API to get them? Or is this something that I'm only imagining exists?

How To Get Paper Sizes From A Printer Using DeviceCapabilities.
The lpOutput parameter (4th parameter) from the DeviceCapabilities function call returns a string. When the iIndex parameter (3rd parameter) is set to DC_PAPERSIZE, the lpOutput buffer receives an array of POINT structures. Each structure contains the width (x-dimension) and length (y-dimension) of a paper size as if the paper were in the DMORIENT_PORTRAIT orientation.

Problem: How do I convert the string result to an array of POINT's?

I tried using the CopyMemory API subroutine to copy the string to a POINT array, but, I received a 'Type Mismatch' error. I also tried copying each 8 bytes (Len(ptPoint)) from the string into a ptPoint variable, but, the result wasn't correct.


Dim lngNumPapers as Long
Dim ptSize as POINTAPI
Dim strPaperSize as string
Dim strPaperSizes as string

' Retrives the number of paper sizes from the default printer device.
lngNumPapers = DeviceCapabilities(Printer.DeviceName, Printer.Port, DC_PAPERSIZE, byval vbNullString, dmDeviceMode)

' Creates a string large enough to contain all the paper sizes.
strPaperSizes = string(len(ptSizes) * lngNumPapers, 0)

' Retrieves the paper sizes from the default printer into a string.
lngNumPapers = DeviceCapabilities(Printer.DeviceName, Printer.Port, DC_PAPERSIZE, byval strPaperSizes, dmDeviceMode)

' Just trying to get the first paper size from the string as a test.
strPaperSize = mid$(strPaperSizes, 1, len(ptSize))

CopyMemory ptSize, strPaperSize, len(ptSize)

Debug.print ptSize.x, ptSize.y





How can I convert the string output variable to an array of POINT's?

Checking Available Font Sizes For A Given Font
In my program I want to change the Font often on different controls so I have opted for the word-processor approach rather than popping up the dialogFont each time.

I have the Buttons for Bold, Italic, Alignment and a Font Name picker. This all works fine.

Is there a way for me to find out what point sizes are available for a selected Font so that I can place these in a dropdown list as well ?

I can work around this by starting the fontsize at 6 and adding .5 continually upto 40 and checking which unique values are returned but It would be nice to do it with a cleaner method.


Code:
Dim wFontSizes(200) As String
'txtFontTest is an invisible Text Box

For i = 0 To Screen.FontCount - 1
a = ""
cbFont.AddItem Screen.Fonts(i)

For j = 6 To 40 Step 0.5
txtFontTest.FontSize = j
If txtFontTest.FontSize <> b Then a = a & " " & Str(j)
b = txtFontTest.FontSize
Next j

wFontSizes(cbFont.ListCount - 1) = a
Next i
Many thanks

I'm just going to populate my list with these sizes for each font - as per VB and MS Word - gives me a decent selection.

8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 40, 48, 72

Thanks for the replies.

Getting Standard Font Sizes For A Font
I was wondering if anyone knew how to get all of the standard listed font sizes for a specific font name.

For example:

In the font common dialog, when you click on certain font names, the list of available font sizes changes.

Say I click on MS Sans Serif. The font sizes that are listed are 8, 10, 12, 14, 18 and 24.

If I click on Courier, I get 8, 10, 12 and 15.

I'd like to know if anyone has a clue how the commondialog gets this info, and where to get it?

Thanks!

Imp

Printer Font Size Vs Picturebox/form/font Size
HI Everibody.
Sorry for my bad English

Why the printer object font size is different as in Picturebox or form font size property?

I copyied in a PictureBox all the properties availabe in the printer object (width, height, scalemode, scalewidth, etc, etc) to simulate a printer object, but the font size in the picturebox is always greater therefore printer.currentX & Y does not match picture1.currentX & Y

Now, how can I configure a picturebox that matches perfectly the printer proportion? I need it to make Preview routine

How can I caculate the correct scale for Picture1?

Font Sizes. What Do They Mean Exactly....
When you see that characters are being printed in, for example, San Serif, size *, what does the * mean. Does it mean the character is 8 pixels high.

Also, how can find out what the Font Parameters are on say, a Picture Box, and I asume they can be altered by the program, yes??

Many thanks for any help

Selecting Font Sizes
Hello All,

Wondering if anyone knew how the retrieve all font sizes for a particular font and place them in a combo.

I've managed to get the system fonts via the following code:

'Integer for loop
Dim FL As Integer
'Clear the combobox
TagCombo(9).Clear
'Loops through all fonts listed on the system
For FL = 0 To Screen.FontCount - 1
'Add the font name to the combo
TagCombo(9).AddItem Screen.Fonts(FL)
Next FL

'Now loop through these fonts and check for the one
'saved in the table
For FL = 0 To TagCombo(9).ListCount
'Select each font in the combo
TagCombo(9).ListIndex = FL
'If the font names match
If TagCombo(9).Text = LabelSettings(9) Then
'Exit the loop as the font is selected
Exit For
Else
'Otherwise set it to the first font in the list
TagCombo(9).ListIndex = 0
End If
Next FL

How can I do the same for the font sizes. Specifically for the one selected in the above combo.

I've tried everything but no success.

VB6 - DPIs And Font Sizes
Hi all, hope you're well and can help me with this question!

My app is skinned, so it doesn't look like normal Windows apps. However, due to the LARGE FONTS option in Control Panel (I believe it changes things from 96DPI to 120 or summit), everything goes out of line when Windows moves the controls about and resizes them etc.

How can I rectify this?

Thanks in advance.

Add Font Sizes To ComboBox?
Is it possible to fill a combo box with the avaible Font Sizes?

List Font Sizes?
Back to the fonts question. Here is how to get all installed fonts, and the size any individual font supports.
VB Code:
Private Sub Form_Load()    Dim i As Long    For i = 0 To Screen.FontCount - 1        cboFonts.AddItem Screen.Fonts(i)    Next i    cboFonts.ListIndex = 0End Sub Private Sub cboFonts_Click()LoadFontSizesEnd Sub Private Sub LoadFontSizes()Dim SaveName As StringDim SaveSize As SingleDim Sizes As VariantDim i As Long'place holders for font name and font sizeSaveName = cboFontSize.Font.NameSaveSize = cboFontSize.Font.Size Sizes = Array(6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72)cboFontSize.Clear'this is the font the user has selectedcboFontSize.FontName = cboFonts.Text    'whip through the array checking all possible font sizes    For i = LBound(Sizes) To UBound(Sizes)        cboFontSize.FontSize = CLng(Sizes(i))        'font supports this size, add to combo           If cboFontSize.FontSize = CLng(Sizes(i)) Then              cboFontSize.AddItem Sizes(i)           End If    Next cboFontSize.FontName = SaveName cboFontSize.FontSize = SaveSizeEnd Sub

Enumerate Font Sizes
Following code returns duplicate font sizes in a combobox
Any suggestions or a better way.

Thanks
David


'Load Font Sizes for Active Font
'VB Substitutes the Closest Available Size
'Note: To get TrueType Fonts < 8 you must
' - Set the Font Size
' - Set the Font Name
' - Reset the Font Size

With Font
For i = 1 To 24 Step 2
.Size = i
' Font.Name = mstrFCFont
' Font.Size = i
cboFCFontSize.AddItem .Size
Next

'Make sure Font Size is set to previous selection
.Size = miFCFontSize

End With

Wandering Font Sizes
Dear all,

A question inspired from thread222-1279176; sorry its a bit long-winded..

Re developing vb forms on two computers with different DPI screen settings.

Computer1 120DPI
Start new form project place a label on the form
Set label font size properties to 16 point Arial
Close/ save project
Resultant font size set in frm code 16.2

Open same project on Computer2 96DPI
Save the form
Close project
Resultant font size in frm code 16.8

Open same project on Computer1 120DPI
Save the form
Close project
Resultant font size in frm code 16.5

from here on I get 16.8, 16.5, 16.8 etc. when passing the code back and forth between the two machines. To summarize the series of font sizes returned is 16.2, 16.5, 16.8, 16.5, 16.8 etc. The initial font size of 16.2 on the 12DPI machine has wandered up to 16.8.

When I begin by setting 16 point Arial on Computer2 96DPI I get the following series 15.75, 15.6, 15.75, 15.6 etc.

For 10 point(intended) Arial I get similar results;
Starting with 120DPI
10.2, 10.5, 10.8, 10.5, 10.8 etc
Starting with 96DPI
9.75, 9.6, 9.75, 9.6 etc.

10 point (intended ) Ms SanSerif gives me;
Starting with 120DPI
9.6, 9.75, 9.6, 9.75 etc
Starting with 96DPI
9.75, 9.6, 9.75, 9.6 etc.

14 point (intended) Ms SanSerif gives me;
Starting with 120DPI
13.8, 13.5, 13.8, 13.5 etc
Starting with 96DPI
13.5, 13.8, 13.5, 13.8 etc.

The test series relating to Arial which start on the 120DPI machine produce three values which then settle down to two.
The test series relating to Ms SanSerif only produce two values.

The tests above are not exhaustive but it seems that Arial's font size can wander nearly a full point size from its intended value when transferring between two machines as above. ref. the two tests begun with Arial on the 120 DPI machine.
 
Are TrueType fonts more prone to this behavior than non-TrueType ones like Ms SanSerif?

Is it possible for font sizes to wander much further away from their intended values in this manner? e.g. a series is produced which keeps on increasing the font size.

regards Hugh,

Printing A Form Whose Size Is More Than The More Than 11* 8.5 Paper Size
Can anybody tell me how to print a Form whose size is more than the More than 11* 8.5 Paper size

Programming For Different Displays And Font Sizes?
I'm working on a VB6 application. The problem is that my boss uses large fonts as his Windows display setting. This causes some forms to be out of wack. It tends to make the forms larger.

Is there any way to prevent this from happening? I know some of the reasoning behind this but can someone provide an explanation?

I may be able to satisfy him if I can stretch a picturebox to the size of the form. Is there a way to stretch a picturebox?

Printing Issues With Font Sizes
Ive tried my best to scan the forums on here and find a similar problem, but wasnt able to. So here is my problem.

Im working on a program that prints badges. eventually it will be used on an actual badge printer, but as of right now, its just being tested on a standard 8.5x11 laser printer. now before we print these badges out, we have it show what the badge will look like, and if i do a file->print, it will be fine.

the problem is if i go through visual basic (via ocx) to print the badge, if i use all the same properties (like fontsize, image size for the picture, location for X and Y, etc) the text is larger and the picture is larger. Id like to do everything in pixels(and i realize scalemode 2 is not pixel), since thats what the program that this is building onto works with and i have this set before writing to the printer buffer.

but its not REALLY what is being shown the screen. ive tried all the other scale modes and none of them are actually matching up. im wondering if there are things i need to convert, or something in order to get these to match up with what is on the screen.

here is a small example of the code...

Dim count As Integer
Printer.Duplex = vbPRDPVertical

Printer.ScaleMode = 2
Printer.CurrentX = 200
Printer.CurrentY = 200

For count = 0 To (textCount - 1)
Printer.CurrentX = text(count).locX
Printer.CurrentY = text(count).locY
Printer.FontName = text(count).font
Printer.fontsize = text(count).fontsize
Printer.Print text(count).value
Next count


Printer.EndDoc

the text array is loaded with all the proper values. i have a feeling that the printer object is doing things in twips and im setting pixel values, but im not really sure. ive tried almost every scalemode there is. Nothing works the way it should though . Hope this helps. Please let me know if you need any other details. Thank you in advance..

Font Sizes With Decimal Points
i'm using the common dialog (font) to set fonts and font sizes but it seems to reject sizes with decimal points (7.5) with the message "size must be a number".

is there any way around this?

Changing Appearance Font's (sizes And Such)
How can you change the Apperance font detatails.

Ok Abit More Tricky...font Sizes
Have managed to get working extraction and loading of a list available screen fonts. Now...different fonts allow different sizes...at least if viewed in word, common dialog etc...is this true????? If so is it possible to extract all available sizes for a font on an individual PC.....

Currently just loading 5 or so common ones, but would like to build a list box of size options based on a select font.


Thanks in Advance
Am using VB5 service Pack 3....sweating on the release of vb7.

Getting Font Sizes To List In A Combo Box
I can't seem to figure out how to fill a combo box with the available font sizes for a given screen font ... for example, Times New Roman has 8,10,11,12 etc where as small fonts has 2,3,4,5,6 etc

Anyone know?

Find Font Sizes For Given Fonts
Hi,

I need to provide a list of available fixed fonts and their available font sizes.

I have loaded the printers fixed fonts in a combo box and would like to be able to load a second combo box with the fonts that are available for the fixed font chosen in the first combo box.

Thanks,
John

Changing Font Sizes On Form Controls
Is there a way to set the font size and type on a form control on an Excel spreadsheet? Not the controls from the Control toolbox, but the controls from the Forms toolbox.

Thanks!

Setting Font Sizes Of Labels In Mschart
Hi! May i know how i can change the font sizes for a mschart? And there is this .TitleText = "LABOUR TURNOVER - " & dept & ""

I need to display the title ---->

Arababa

1999- 98

Currently I can only get one of them out , I cant seem to get one on top of the other. Can someone advise? Thanks

Currently i get this ---> arababa 1999- 98

Registry Entries Screwing Up Font Sizes On My Workstation?
I installed a beta app (written in vb) that somehow made the screen fonts for some applications larger than they are supposed to be. I have uninstalled the app but the font issue is still there. For instance, i just installed wsftp and i cannot use it as the fonts are too big and all the form items do not show on the form.

Can anyone give me a tip perhaps to where in the registry i might look for these leftover settings?

Thanks!

Detecting The Current Font And Font Size On Various Lines In A Rich Text Box.
I have written an editor that uses a rich text box as the main text area.

The editor allows the user to select a font and font size on the toolbar.

My question is, how does one get the combo box text (for both the font and font size) to display the font or font size for the current line of the current character location?

Meaning, if I were to type in two lines, the first line being Arial 12pt, and the second line being Tahoma 14pt, how would I get the program to display the font and font size in the combo boxes?

I know about SelFont, SelStart and such, but I am not selecting any text. I am merely moving the cursor up or down and need to be able to display the font and font size for where the cursor currently is.

Anyone have any ideas?

I thank you in advance.

Detecting Font And Font Size On Various Lines In A Rich Text Box.
I have written a basic editor that uses fonts and such, however when I select a different line (while entering text into the text area of the rich text box), it doesn't display the font or font size for that particular location.

Does anyone have any ideas where I can look to solve this problem?


I thank you in advance for any information you may be able to share with me.

How To Get The Font Name And Font Size Of Header/footer Text?
Hi Everybody

Simple question.

In one of my procedures, I write the VBA Excel code set the text for headers and footer specifying the font name and font size (code line shown below in part).


Code:
'...
'...
'worksheetName has been previously defined to contain the
'name of the worksheet being handled
fullFilename = ActiveWorkbook.FullName
footerText = fullFilename & "[" & worksheetName & "]"
With ActiveSheet.PageSetup
.LeftFooter = "&""Times New Roman,Regular""&06" & footerText
End With
'...
'...


However, when I try to read the same (header/footer text) using code and assign it to a string variable, it actually includes the VBA code referring to the font name and font size as well. This is what I get (the contents of the string variable is shown below).

&"Times New Roman,Regular"&06H:MSOFFICEMY DOCUMENTSCombined National Monthly ReportTest11.xls[SBU - East]

Have a look at all the text prior to "H:..."

But when you see the header/footer content in pagesetup -> headers/footers, you only see the actual text viz :-

"H:MSOFFICEMY DOCUMENTSCombined National Monthly ReportTest11.xls[SBU - East]"


Is there a way to read this actual text only in to a string variable?


Best regards


Deepak Agarwal

Retain Font Styles When Changing Font Size
March 25, 2008

Re: VB6

Hello, everyone. I searched for over two hours for an answer but didn't find a relevant forum example. I am using a richtextbox for my documentation. I made several simple font features such as font sizes and font styles (bold and underline) to the richtextbox. The problem I have is that after I bolded and underlined some of my document text, if I change my document to a different font size, any text that have been bolded or underlined will be undone, so I have to highlight them and bold or underline them again. Does anyone have any advice or any example code to correct it?

The following is a fragment of code in selecting for fontbold and for changing font size:

If Len(Trim(RichTextBox1.SelText)) > 0 Then' For selecting text
RichTextBox1.SelFontSize = 14
End If
RichTextBox1.SelBold = Not (RichTextBox1.SelBold)' For selecting text for bold
RichTextBox1.Font.Size = 14 ' Font size to the whole document or richtextbox

Any advice or help will be greatly appreciated.

Mydanvue

How To Change The Font Type And Font Size For A Menu Bar?
Dear all,
I meet a problem in my application. How can i change the font type and font size for the menu used in th form? Since my application is run on 1280x1024, it is too small to see the type on the menu bar. Could anyone help me? Very urgent!!! Thanks.

Paul

Get Paper Size Using VB
hi

does any one know how to get the printer paper size ie height and width.
What dll do I use and if you have an example that would help.

Thanks

zann

Paper Size
Hi, Just Asking on How to set the Paper Size of a DataReport to Legal (8.5x14)?
I try using CommonDIalog Box but it doesn't work..

CommonDialog1.Flags = 64
CommonDialog1.ShowPrinter

I always go to the Printers and Faxes and set the Paper Size to Legal..
But my other projects, need only Letter(8.5x11) that's why I am going to back it's paper size to (8.5x11)..
What code should I write, so that everytime I run this program, the Paper Size will automatically set to Legal (8.5 x 14)
Hope you can help me with this?

Paper Size
anyone have idea on how to set custom papersize for crystal report 8.5?

Paper Size
hi,
 does any gurus/newbies/fanatics know how to change the data report size from A4 to A5... is it possible?

thanks for any avail!

Get Paper Size
How can get all paper size which are available in the system to a list box?

Paper Size
Hi there,
How do I set the paper size to 8.5* 3.66 (default 8.5 * 11)??
This is because I have to print form in dot matrix printer in a 1/3 lenth of a regular paper size.

thank you,
kethees

Paper Size
hello. good day.

how can i retrieve all the supported paper size for a printer?
and how can i set the paper size?

i have tried using the printer collection, but always causes an error.


thanks for the help.

Changing Font Size And Bold And Font ???
dim Heading as string
Heading = "I want to Make this sentance Bold and bigger"

how would i go about making this variable bold and changing the font and font size.
thankyou

How Can I Automaticaly Fit The Paper Size?
Hi,

Let me try to explain what I want exactly

One of my program is successfully populating the records into many excel worksheets with the given format.
Some of those details are going to many coloums (horizontaly from 'A' coloum to 'O' coloumn). When I am trying print those excel worksheet is A4 size paper, it is coming into more than one paper ('A' to 'K' in one sheet and remaining into another sheet)

How can i automaticaly fit into the A4 size paper width by coding wise?

I know that manually we can go and adjust the size by a draging the lines in print view page. Can I do that through excel automating coding? Is it possible to do? Now everytime user has to go and manually set the lines to fit into the page width

Pls shed some lights on this

Define Paper Size
hi,



Can we define Paper Size (A4 or Legal or Letter) while printing thro macro?.

By giving this below code, it is taking defalut paper size. any idea regarding this.


Range("A1:E25").Select
Selection.Copy
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

suresh

Paper Size Names
Hi,

I'm using the DeviceCapabilities API funciton to retrieve the paer sizes my printer support. I want to display these paper sizes in a combo box. However, the function only returns numeric constants. How do I find paper size name (ie. A4 or Legal) corresponding to a given constant?

Thanks

Change Paper Size
what is the cording to change paper size and set as landscape .. what is the right cording i m trying like this

printer.papersize = 9
printer.oriantation = 2

its not working
y is that ??

what should i do

Printing Paper Size
I am printing a Data grid to the printer in my application and use a the common dialog box to get the settings. The user can in the advanced settings set the paper size. How do I go about getting this infomation so I can set the paper size when I print. There isn't a property in the Object to get this.

Maybe a API Call????

Printer Paper Size
Hi,

Can anyone tell me a way to set the paper size dynamically in vb? I am developing an application that prints timetables for students. I need to set the paper size dynamically..

Thanks in advance..

graci`as

HOLHI

Custom Paper Size
my reports is designed to print in a custom paper size, 8.5 x 5.5 inch (half of Letter size). thats a problem if my program run in xp.

if i run in win98 or ME, thats not problem. i just have to set a custom paper size in the printer setting. i just set the width=850 and length(height) = 550 as well. (pic1)

BUT, when i run in xp, i cannot set custom paper size... How to set custom paper size? i cannot found custom paper... (pic2)

pls help. tq.

Print Paper Size
Using a Intermec label printer what line of code do I use to tell it to print 4 inches by 6 inches. I know i can change these settings in the driver, but we are having complications with that. So, if anyone knows the code to set the paper size settings, it would help out a lot.

Thanx in advance.

Print Paper Size
Hi VB Masters ...

i hope someone can help me out with this ...
i have created a couple of forms that have picturesboxs in them .. these images are some documents i scanned ..

my objective is to print these forms wit the exact size of the picturesbox in them (and so i did thanks to this Forums help by adding hte following printpicturebox picture1, 0, 0)

but for some i noticed that one of the picture i inserted to the form is not an A4 size instead its a 33 cm paper size ..

-can i give a command about paper size in the form (VB) or is it not possible
-Or this issue should be solved with the printer i am using .

i am using a Xerox photo copy printer witch can take 2 paper sizes at the same time..

Your help is higly apprexiated.
Thanks

Copyright 2005-08 www.BigResource.com, All rights reserved