Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

TComponent(TLabel change font size)

Posted on 2004-04-27
3
Medium Priority
?
586 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
[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
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
geobul earned 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

618 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