【发布时间】:2015-12-21 15:36:03
【问题描述】:
我在 Delphi7 中使用 TWebBrowser 作为 HTML 编辑器,在 OnDocumentComplete 中将其 designMode 设置为“on”。
我知道如何更改字体属性,如粗体、斜体、字体、颜色、对齐等。我正在使用带参数的 exeCommand
var
htmlDoc: HTMLDocument;
parameter: OleVariant;
begin
(wbEditor.Document as IHTMLDocument2).ParentWindow.Focus;
htmlDoc := wbEditor.document as HTMLDocument;
htmlDoc.execCommand('bold', false, parameter);
(wbEditor.Document as IHTMLDocument2).ParentWindow.Focus;
end;
问题是当我在文本中更改光标位置时如何读取“粗体”和其他属性。
假设我的文本类似于“foo bar”。当我将光标定位在 FOO 时,我想选中一个“粗体按钮”,但当我将它定位在 BAR 时未选中。
???
【问题讨论】:
标签: html delphi delphi-7 twebbrowser