Solved

Labels and font sizes

Posted on 2002-07-06
9
323 Views
Last Modified: 2013-12-02
How can I print font in ANY sizes (not just whole numbers)?  I'd like to be able to make a resizable label, that shrinks the font when the label gets smaller.

Thanks,
-Sam
0
Comment
Question by:samsonite1023
  • 5
  • 4
9 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 75 total points
ID: 7134609
"VB silently uses the closest valid font size that is less than the requested size"
http://www.vb2themax.com/Item.asp?PageID=TipBank&ID=285

Maybe you can change kerning (spacing between characters), to make smoother changes:
http://www.vbaccelerator.com/codelib/gfx/textefx.htm
0
 
LVL 1

Author Comment

by:samsonite1023
ID: 7136074
Know of any API calls I can use to make font any size?
0
 
LVL 15

Expert Comment

by:ameba
ID: 7136298
Any size - no.
There is a CreateFontIndirect API, which can set many properties, but not ANY size.
0
 
LVL 15

Expert Comment

by:ameba
ID: 7136426
Another option is to use ExtTextOut - it can fit a rectangle, by adjusting space between characters.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:samsonite1023
ID: 7136872
That is exactly what I need.. please tell me more!

Also, I could work with the kerning thing, but how can I get the DC of a label? (if it has one)

Thank you so much for your help

-Sam
0
 
LVL 15

Expert Comment

by:ameba
ID: 7137197
You cannot draw on a label - it doesn't have DC or Hwnd property, it's windowless control.
I thought you were creating your own control.
0
 
LVL 1

Author Comment

by:samsonite1023
ID: 7137427
Yes, but it uses a visual basic label.

I needed the autosizing capabilities of it.

Should I just draw directly onto the UserControl window?  I guess that would give me much more options.  I could have an invisible label that finds the size of the text.

Thanks for your help

-Sam
0
 
LVL 1

Author Comment

by:samsonite1023
ID: 7137665
Do you know of any way to find the width of text? (via API)

If I can find that, I'll be set.

Thanks,
-Sam
0
 
LVL 15

Expert Comment

by:ameba
ID: 7137712
Sorry, I stopped answering because of some issues with EE.  Feel free to ask for refund of points in Community Support topic area: http://www.experts-exchange.com/commspt/
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now