Start New Discussion Reply to this Discussion working with TFontStyles in stringlist I need abit of help
am trying to rebuild my chat content by storing it into a stringlist first and then re-pushing it out but problem am having is with my font settings i can not work out how to add my font styles to the string has anyone got any code to show how this is done?
thanks alot
Simon180
Light Poster
32 posts since Feb 2010
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0
I would use a XML to store all the informations that you will need, the font, the text and etc.Try to do something like this:
<?XML version="1.0"?>
<FirstGuy>
<font>clRed</font>
<content>Hello my friend.</content>
</FirstGuy>
<SecondGuy>
<font>clRed</font>
<content>Hello FirstGuy</content>
</SecondGuy>
function StrToColor(Value: string): TColor;
begin
Value := UpperCase(Value);
if Value = 'BLACK' then
Result := clBlack
else if Value = 'MAROON' then
Result := clMaroon
else if Value = 'GREEN' then
Result := clGreen
else if Value = 'OLIVE' then
Result := clOlive
else if Value = 'NAVY' then
Result := clNavy
else if Value = 'PURPLE' then
Result := clPurple
else if Value = 'TEAL' then
Result := clTeal
else if Value = 'GRAY' then
Result := clGray
else if Value = 'SILVER' then
Result := clSilver
else if Value = 'RED' then
Result := clRed
else if Value = 'LIME' then
Result := clLime
else if Value = 'YELLOW' then
Result := clYellow
else if Value = 'BLUE' then
Result := clBlue
else if Value = 'FUCHSIA' then
Result := clFuchsia
else if Value = 'AQUA' then
Result := clAqua
else if Value = 'WHITE' then
Result := clWhite
else
Result := clBlack;
end;
var
Node, Noode : IXMLNode;
begin
Node := XMLDocument1.DocumentElement.ChildNodes.FindNode('FirstGuy');
if (node <> nil) then
begin
Memo1.Lines.Add(Node.ChildNodes['content'].Text);
end;
Noode := XMLDocument.DocumentElement.ChildNodes.FindNode('SecondGuy');
if (noode <> nil) then
begin
Memo1.Lines.Add(Noode.ChildNodes['content'].text);
end;
Memo1.Font.Color := StrToColor(Node.ChildNodes['font'].text);
end;
AceStryker
Light Poster
47 posts since Aug 2011
Reputation Points: 10
Solved Threads: 3
Skill Endorsements: 0
© 2013 DaniWeb® LLC
Page generated in 0.0581 seconds
using 2.66MB