Solved

TComponent(TLabel change font size)

Posted on 2004-04-27
3
571 Views
Last Modified: 2013-12-03
Hi

I want to change all my Tlabel's font size to 9. How can I do that instead of going to each labels and change its property field. Each label have different names.. so I can use the FindComponent

ex.
var
  i: Integer;
begin
  for i := 1 to 20 do begin
    with TLabel(FindComponent(Label + IntToStr(i))) do
      Font := 9;
  end;

Many thanks and cheers,
mha
0
Comment
Question by:michaenh
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 125 total points
ID: 10927554
Hi,

 Try this:

var i: integer;
begin
  for i := 0 to Form1.ComponentCount - 1 do begin
    if (Form1.Components[i] is TLabel) then
      (Form1.Components[i] as TLabel).Font.Size := 15;
  end;
end;

Regards, Geo
0
 

Author Comment

by:michaenh
ID: 10927654
Thanx.

You are the greatest!
:) cheers

mha
0
 
LVL 17

Expert Comment

by:geobul
ID: 10927867
The pleasure was mine :-)
0

Featured Post

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

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

19 Experts available now in Live!

Get 1:1 Help Now