c++ - MSHTML 编辑 - 更改文本选择颜色
问题描述
我在设计(编辑)模式下使用MSHTML
(控制)。TWebBrowser
我使用TEmbeddedWB
但慢慢远离该组件并实现我自己的界面。When a block of text is selected, so when typing into the editor and then selecting a block of text it is in black color for the background color.
相反,我想使用蓝色。
我知道它与选择范围有关,但不确定如何在设计器模式下对其进行修改。下面的代码当然是不在设计模式下的。
IHTMLSelectionObject currentSelection = document.selection;
IHTMLTxtRange range = currentSelection.createRange() as IHTMLTxtRange;
if (range != null)
{
range.execCommand("BackColor", false, "0000FF");
}
有任何想法吗?我必须使用事件接收吗?或者也许QueryCommandValue
?我尝试了一些HiliteColor
没有成功的事情(根据 Mozilla 文档,Internet Explorer 不支持)。
我使用 C++ Builder 或 Delphi,但欢迎使用任何语言的代码示例,我可以(可能)翻译它。
解决方案
推荐阅读
- qml - 如何跟踪 QML 粒子死亡
- python - Pandas 根据时间间隔删除重复的行
- android - Flutter generateJsonModelDebug 同时使用 ffi 包含的库
- oracle - 需要帮助将 Oracle 触发器转换为 Mariadb
- reactjs - 在使用 redux-observables 开始另一个史诗之前,如何等待不同的史诗完成并更新商店?
- android - 如何合并两个 Firestore 查询以作为 Kotlin 上的选项传递
- eclipse - 如何在 Eclipse 4.16 中制作功能插件或扩展。请帮助我
- python - 将重复项转换为 nan 仅保留最后一次出现
- google-cloud-platform - 谷歌云sql数据读取审计日志
- c - GCC 可以警告库中未定义的函数吗?