Delphi TWebBrowser 设置焦点


本文整理自网络,侵删。

 
设置焦点 (当Webbrowser处于编辑模式) 
TWebBrowser非常特殊,它从TWinControl继承来的SetFocus方法并不能使得它所包含的文档获得焦点
//方法1
procedure TForm1.ToolButton1Click(Sender: TObject);
begin
   if Form1.WebBrowser1.Document <> nil then
     with WebBrowser1.Application as IOleobject do
        DoVerb(OLEIVERB_UIACTIVATE, nil, WebBrowser1, 0, Handle, GetClientRect());
end;
 
//方法2 Form1OnCreate事件无效
if WebBrowser1.Document <> nil then
    IHTMLWindow2(IHTMLDocument2(WebBrowser1.Document).ParentWindow).Focus();

相关阅读 >>

Delphi 使用indy解决tidssliohandlersocketopenssl could not load ssl library错误

Delphi app检测智能手机震动

Delphi dbgrideh footer的设置和使用

Delphi android调用授权管理打开通知监听服务

Delphi 简单的日志记录

Delphi urunpe

Delphi加载图像存储到数据库中

Delphi webbrowser 操作记要

Delphi 隐藏,显示其他程序的托盘图标

Delphi 自带的 base64 编解码函数

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...