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.
Default Font for DBRichviewedit
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;
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;
-
- Site Admin
- Posts: 17530
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
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.
As for the ruler (if you use it), I believe it will be updated automatically.