Memo's Font, Style, Color in Hexadecimal.

Hello Experts.
 
  I have been trying to figure this out for a very long time. Memo's Font, Color, Size and Style saved into windows registry in hexadecimal. I would like to store TMemo's font settings into the windows register in hexadecimal format, including color size just like notepad does in Windows 98. If someone could provide examples please. Thank's Hyperion66
hyperion66Asked:
Who is Participating?
 
viktornetConnect With a Mentor Commented:
Font's Color
---------------
var
       S : string;
     begin
       S := IntToHex(BUtton1.Font.color, 10);
       Caption := S;
     end;
Font's Size
---------------
var
  S : string;
begin
  S := IntToHex(Button1.Font.Size, 5);
  Caption := s;
end;

You need to figure out a way for the style...for example create your own values for each of the syles....

if it's Bold then 0
Italic 1
Bold and Italic 3
and so on....Then right them as follows

var
  s : string;
begin
  S := IntToHex(GetStyle(Memo1.Font.Style), 5);
  Caption := s;
end;

Where GetStyle() function has to return an integer./

Regards,
Viktor Ivanov
0
 
viktornetCommented:
How about this...
var
  S : string;
begin
  S := IntToHex(BUtton1.Font.color, 10);
  Caption := S;
end;

0
 
hyperion66Author Commented:
OK great, i know most of what you just typed except for how to use hex in the registry..i'll try the code right now and get back to you vary soon.  Thank's viktornet's.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
viktornetCommented:
Use the WriteString of the registry....
uses Registry;
{...}
var
  reg : TRegistry;
  s : String;
begin
  S := IntToHex(BUtton1.Font.color, 10);
  reg := TRegistry.Create(self);
  try
    reg.WriteString('TheKey', S);
  finally  
    reg.free;
end;

Regards,
Viktor Ivanov
0
 
viktornetCommented:
I forgot .....you  need to use reg.OpenKey()

//Vik
0
 
hyperion66Author Commented:
hmm i'm still having problems, I connaot seem to get IntToHex to work. All i want to get it to do is write this Regini.WriteInteger('','FontColor',Memp.Font.Color); into Hex format in the registry.
0
 
viktornetCommented:
You cannot do you the way you try.... Why not use it this way.....??

Regini.WriteString('', 'FontColor', IntToHex(Memo.Font.Color, 10));

//Vik ;->
0
 
hyperion66Author Commented:
No the code works, i just can't get it to read from hex..I can write it into hex but not read it from hex.
0
 
hyperion66Author Commented:
No the code works, i just can't get it to read from hex..I can write it into hex but cannot read it from hex.
0
 
viktornetCommented:
Hello!

First you write it into the registry as a Hexadecimal string, then when you read it, read it as a string and then use a function that converts the string to a hexadecimal....

//Vik
0
 
hyperion66Author Commented:
Thank's Viktornet.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.