I am using the following code:
Code: Select all
SRichViewEdit1.RichViewEdit.InsertText('Mario da Silva',false);
Can you help me?
Thanks.
Code: Select all
SRichViewEdit1.RichViewEdit.InsertText('Mario da Silva',false);
Code: Select all
// returns an index of a text style having the same properties
// as the current text style, but the specified color
// (searching for an existing style; if not found, adding a new style)
function GetColoredTextStyleNo(rve: TCustomRichViewEdit; Color: TColor): Integer;
var TextStyle: TFontInfo;
begin
TextStyle := TFontInfo.Create(nil);
TextStyle.Assign(rve.Style.TextStyles[rve.CurTextStyleNo]);
TextStyle.Color := Color;
Result := rve.Style.FindTextStyle(TextStyle);
TextStyle.Free;
end;
// returns an index of a paragraph style having the same properties
// as the current paragraph style, but the specified alignment
// (searching for an existing style; if not found, adding a new style)
function GetAlignedParaNo(rve: TCustomRichViewEdit; Align: TRVAlignment): Integer;
var ParaStyle: TParaInfo;
begin
ParaStyle := TParaInfo.Create(nil);
ParaStyle.Assign(rve.Style.ParaStyles[rve.CurParaStyleNo]);
ParaStyle.Alignment := Align;
Result := rve.Style.FindParaStyle(ParaStyle);
ParaStyle.Free;
end;
// Using:
SRichViewEdit1.ActiveEditor.ApplyParaStyle(GetAlignedParaNo(SRichViewEdit1.ActiveEditor));
SRichViewEdit1.ActiveEditor.CurTextStyleNo := GetColoredTextStyleNo(SRichViewEdit1.ActiveEditor);
SRichViewEdit1.ActiveEditor.InsertText('Mario da Silva',false);
Code: Select all
procedure GoToLine (LineNo: Integer; rve: TCustomRichViewEdit)