Solved

TComponent(TLabel change font size)

Posted on 2004-04-27
3
575 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
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…

815 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

8 Experts available now in Live!

Get 1:1 Help Now