Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从html页面调用winform函数?_Html_Winforms_Webbrowser Control - Fatal编程技术网

从html页面调用winform函数?

从html页面调用winform函数?,html,winforms,webbrowser-control,Html,Winforms,Webbrowser Control,我有一个winform应用程序,它包含一个c#webbrowser控件。webbrowser控件加载一个html页面。在html页面上我有一个按钮。我想要的是,当单击该按钮时,它将调用winform函数(例如Form1.cs中的函数)。可能吗?请帮助我在脚本代码中使用对象访问指定对象的公共属性和方法。(参见链接中的示例) C# HTML <button onclick="window.external.Test('called from script code')"> cal

我有一个winform应用程序,它包含一个c#webbrowser控件。webbrowser控件加载一个html页面。在html页面上我有一个按钮。我想要的是,当单击该按钮时,它将调用winform函数(例如Form1.cs中的函数)。可能吗?请帮助我在脚本代码中使用对象访问指定对象的公共属性和方法。(参见链接中的示例)

C#

HTML

<button onclick="window.external.Test('called from script code')">
    call client code from script code
</button>

从脚本代码调用客户端代码
<button onclick="window.external.Test('called from script code')">
    call client code from script code
</button>