winform提供皮
private void Form1_Load(object sender, EventArgs e)
{
External ext = new External(this);
webBrowser1.ObjectForScripting = ext;
}
}
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class External
{
Form form;
public External(Form form)
{
this.form = form;
}
public void wappFullScreen(bool flag)
{
if (flag)
{
form.WindowState = FormWindowState.Maximized;
}
else
{
form.WindowState = FormWindowState.Normal;
}
}
{
External ext = new External(this);
webBrowser1.ObjectForScripting = ext;
}
}
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
public class External
{
Form form;
public External(Form form)
{
this.form = form;
}
public void wappFullScreen(bool flag)
{
if (flag)
{
form.WindowState = FormWindowState.Maximized;
}
else
{
form.WindowState = FormWindowState.Normal;
}
}
}
脚本可以调用得到
window.external.wappFullScreen(flag);