TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: TONY DUNN
date: 1997-06-29 22:43:00
subject: Font style property?

Hello All
I want to read [and write] to an INI file with Delphi 1.0 for the style
property of a font of (say) a label. I have coded up the name and size 
options,
but style is giving me a headache. Here is the code so far:
procedure TForm1.Button1Click(Sender: TObject);
begin
if FontDialog.Execute then
   label1.font := FontDialog.Font;
   label1.caption := 'Selected font is ' + label1.font.name;
   label2.caption := 'Font size is ' + inttostr(label2.font.size);
   TestIni := TInifile.Create ('d:\delphi\study\test.ini');
   TestIni.WriteString('Fonts', 'LabelFontName', label1.font.name);
   TestIni.WriteInteger('Fonts', 'LabelFontSize', label1.font.size);
   TestIni.Free;
end;
What I want to do is get the value of the font.style property for fsBold,
fsItalic and so on, then write this value to the INI file as a boolean value,
but I can't figure out how to determine this from the FontDialog.Execute 
return
value. Strings and integers are fine, read and write them no problem, but the
style boolean is causing me *big* grief.
Help? Replies to mail address below fastest, and any ideas appreciated!
Regards
Tony 
--- GEcho/32 1.20/Pro
---------------
* Origin: Tony's Point of View (2:250/102.2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.