trichview.com

trichview.support




Re: how add Microsoft Equation to richview?


Return to index


Author

Message

Sergey Tkachenko

Posted: 04/21/2004 19:57:09


Via TOleContainer.


I modified code from Demos\Delphi\Editors\Editor 1\, from menu Edit | Paste

As | OLE:


var oc: TOleContainer;

    created: Boolean;

begin

  oc := TOleContainer.Create(nil);

  oc.Visible := False;

  oc.BorderStyle := bsNone;

  oc.Parent := RichViewEdit1;

  created := True;

  try

    oc.CreateObject( 'Equation.3', False);

  except

    try

      oc.CreateObject( 'Equation.2', False);

    except

      try

        oc.CreateObject( 'Equation', False);

      except

        created := False;

      end;

    end;

  end;

  if not created then begin

    oc.Free;

    exit;

  end;

  oc.SizeMode := smAutoSize;

  oc.OnResize := OnOleResize;

  oc.OnActivate := OnOleActivate;

  oc.OnDeactivate := OnOleDeactivate;

  oc.Visible := True;

  oc.OnMouseUp := OnOleMouseUp;

  RichViewEdit1.InsertControl('', oc,rvvaBaseline);

end;


All code for working with OleContainers in RichViewEdit can be found in this

demo (search for substring "ole"). All of this code is necessary.

Unfortunately, equations not always resized correctly. Sometimes you need to

activate it several times until it's resized as expected. Besides, I do not

know how to change background color of OleContainer.





Powered by ABC Amber Outlook Express Converter