Default Font for DBRichviewedit

General TRichView support forum. Please post your questions here
Post Reply
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Default Font for DBRichviewedit

Post by carloscastro »

Hi,

How can i set the default font in a DBRichview edit.
Whenever i create a new record in a database and use dbrichview to edit a text field it assumes verdana font as default.
How can i change this.

Thanks.
j&b
Posts: 184
Joined: Mon Sep 05, 2005 1:35 pm

Post by j&b »

Click TDBRichViewEdit/Ereignisse/OnNewDocument

procedure TForm1.memoNewDocument(Sender: TObject);
begin
rvs.TextStyles.clear; rvs.ParaStyles.clear; rvs.ListStyles.clear;
rvs.TextStyles.add; rvs.TextStyles[0].FontName:='Arial';
rvs.TextStyles[0].Size := 11;
rvs.PageBreakColor:=clRed;
rvs.ParaStyles.add; rvs.ParaStyles[0].alignment:=rvaLeft;
rvs.ParaStyles.add; rvs.ParaStyles[1].alignment:=rvaCenter;
rvRuler1.leftMargin:=0.1;
RVRuler1.Width:=memo.Width;
rvRuler1.rightMargin:=4;
end;
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, use OnNewDocument event to create default set of styles. Clear collections of text, paragraph and list styles, then add at least one text and at least one paragraph style. TextStyles[0] and ParaStyles[0] define default properties. Of course, this RVStyle must be used only by this TDBRichViewEdit, and styles must be saved in documents (right click DBRichViewEdit in Delphi, choose "Settings" in the popup menu, make sure that "Allow adding styles dynamically" is set.

As for the ruler (if you use it), I believe it will be updated automatically.
carloscastro
Posts: 13
Joined: Fri Feb 24, 2006 5:48 pm

Post by carloscastro »

Ok...

Many thanks...it works

Thanks
Post Reply