?
Solved

Labels and font sizes

Posted on 2002-07-06
9
Medium Priority
?
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 15

Accepted Solution

by:
ameba earned 300 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

752 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