Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

Open a file in my notepad application with a specific fontname/size as default (part2)

Dear Experts,

In my previous question I got the comment that I had to be more specific about my problem.
My appologies.

I am Dutch and my English isn't very well. So I try to explain my problem:

I have made a Notepad that uses a TRichEdit. I want that when a user open's a text-file
(.doc . txt .rft) with my Notepad-application. The file will be showned in my Trichedit with
a default Fontname Arial and FontSize 14. And that the user can change the default fontname
and size in a MainMenu-item called Change default font.

I hope I have explaint my problem better this time.

I have received a good solution on my previous question, but I don´t know how to implement it.
Could someone help with it...

Greetings,
Peter



procedure TForm1.LoadInRichEdit(FileName: string);
begin
  RichEdit1.Clear;
  RichEdit1.Font.Name := 'Arial';
  RichEdit1.Font.Size := 14;
  RichEdit1.Lines.LoadFromFile(FileName);
end;

Open in new window

Avatar of Lukasz Zielinski
Lukasz Zielinski
Flag of Poland image

put TFontDialog on your form and try this:

procedure TForm1.Button6Click(Sender: TObject);
begin
  if FontDialog1.Execute then
    RichEdit1.Font := FontDialog1.Font;    
end;


is it what you looking for?

p.s. Ik dacht dat alle Nederlanders praat engels heel goed;)

ziolko.
Avatar of Peter Kiers

ASKER

yes, now we have to set a default fontname and size
SOLUTION
Avatar of Lukasz Zielinski
Lukasz Zielinski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank for all the help