Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can one control Font during Runtime? 2

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA

I need to control the font of contents of a particular field in a unique situation during RunTime.

I expect I need something like ...

Code:
 if tblMyTablePNo.value = 2 then
 begin
   fldOurInit.FontSize := 22;
   fldOurInit.FontStyle := BoldItalic;
   fldOurInit.FontColor := Red;
 end;

.... which needless to say doesn't work.

Anyone? Thanks in advance.
 
this is how its done
i put this in the onchange event of a dbtext box

var FontSet: TFontStyles;
begin
FontSet:=[fsBold,FsItalic];
if DBEdit.Text='Hello' then
begin
DBEdit.Font.Size := 22;
DBEdit.Font.Style := FontSet;
DBEdit.Font.Color := clRed;
end;
end;

Aaron Taylor
John Mutch Electronics
 
remember when dealing with properties of properties you need the dot.

label has property font (label.font)
font has property size (font.size)
all together (label.font.size)

font.style is a tstyleset so you need to assign a the set first set1:=[fsBold,fsItalic] or set1:=[fsBold] ect...

:)

Aaron Taylor
John Mutch Electronics
 
Also, after you change the font in your code, you may need to include this:

application.processmessages;

for the change to appear.

-Dell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top