trichview.com

trichview.support




Re: word underline


Return to index


Author

Message

Anonymous

Posted: 11/05/2003 19:03:35


"Marius Zemaitis" <marius@lvat.lt> wrote:

>How to underline words ir RichViewEdit with

>red line (like in Word, misspelled words), but

>that the words remain in the same item? For example

>some words in the same item are underlined and some not.


You can use OnDrawStyleText event of TRVStyle.


var uWord: string;//text to be underlined.


procedure TForm1.RVStyle1DrawStyleText(Sender: TRVStyle; const s: String;

  Canvas: TCanvas; StyleNo, SpaceBefore, Left, Top, Width, Height: Integer;

  DrawState: TRVTextDrawStates; var DoDefault: Boolean);

var p: integer;

    s2: string;

begin

  p:=Pos(uWord, s);

  s2:=s;

  while p>=1 do

  begin

    s2[p]:=' ';

    Canvas.Pen.width:=1;

    Canvas.Pen.Color:=clRed;

    Canvas.MoveTo(left+Canvas.TextWidth(Copy(s, 0, p-1)), top+height);

    Canvas.LineTo(left+Canvas.TextWidth(Copy(s, 0, p-1)+uWord), top+height);

    p:=Pos(uWord, s2);

  end;

end;





Powered by ABC Amber Outlook Express Converter