VCL – Load HTML code in TWebBrowser
Easy HTML editor with instant preview into TWebBrowser
Component to use:
– TSynedit
– TSynHTMLSyn
– TWebBrowser
– TTimer (set Interval 1000)
– TSplitter (set Align alLeft)
Here the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
procedure TForm1.SynEdit1KeyPress(Sender: TObject; var Key: Char); begin Timer1.Enabled := True; end; procedure TForm1.Timer1Timer(Sender: TObject); var Doc: Variant; begin Timer1.Enabled := False; if not Assigned(WebBrowser1.Document) then WebBrowser1.Navigate('about:blank'); Doc := WebBrowser1.Document; Doc.Clear; Doc.Write(SynEdit1.Lines.Text); Doc.Close; end; |