html中的js调用c#的winform程序
2020-11-24 23:09
标签:winform style blog class code tar 简单来说,就是在c#客户端winform中加载一个webBrowser1,然后通过webBrowser1中对页面的点击js效果触发c#的函数响应。亲测通过。 C#代码如下: js代码如下:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace testJS
{
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public partial class Form1 : Form
{
public void say()
{
MessageBox.Show("OK");
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.webBrowser1.ObjectForScripting = this;
this.webBrowser1.Navigate("http://localhost/1.html");
}
}
}
}
hi
测试可以输出
html中的js调用c#的winform程序,搜素材,soscw.com
html中的js调用c#的winform程序
标签:winform style blog class code tar
原文地址:http://blog.csdn.net/itbuluoge/article/details/25468271