Solved

Canvas text size

Posted on 2001-08-06
3
180 Views
Last Modified: 2010-04-06
I want to print a number on form canvas. The number is inside a box.

In a procedure I wrote

Var  Rect : TRect;
begin
  Rect := ...
  canvas.font.height := rect.bottom -rect.top - 5;
  textrect(rect.left, rect.top, inttostr(Num));
end;

I found the size of the number was changed with the rect's size, but it's smallest size is about 6,how can I let it smaller?

PeterShaw
0
Comment
Question by:petershaw8
  • 2
3 Comments
 
LVL 2

Expert Comment

by:bugroger
Comment Utility
Hi,
 I think you don 't use a TrueType - Font.

Try to set the font to a TrueType Font:

Var  Rect : TRect;
begin
 Rect := ...
 Canvas.Font.Name := 'MS Song'; <-- Set Font to TT - Font
 canvas.font.height := rect.bottom -rect.top - 5;
 textrect(rect.left, rect.top, inttostr(Num));
end;

Now the smallest size should be 1 !!!

GL
 Bug





0
 

Author Comment

by:petershaw8
Comment Utility
Hi,
Iam using the default font, that is MS Sans Serif. Is it a TT font?

Thankuvery much.

PeterShaw
0
 
LVL 2

Accepted Solution

by:
bugroger earned 100 total points
Comment Utility
Hi,

The MS Sans Serif is not a TrueType Font.

If you want to know if a Font is a TrueType Font
you can look at the FontDialog.
Just klick on [...] at the "FONT" Property of any
component which used this property.
If a TT-Glyph will be display on the left side of the
FontName (in the ListBox) then it is a TrueType Font.


GL
 Bug









0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 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