RFID的winform程序心得2

RFID的winform程序心得1

webBrowser1.AllowWebBrowserDrop = false;//将 WebBrowser 控件的 AllowWebBrowserDrop 属性设置为 false,以防止 WebBrowser 控件打开拖放到其上的文件。
webBrowser1.IsWebBrowserContextMenuEnabled = false;//将该控件的 IsWebBrowserContextMenuEnabled 属性设置为 false,以防止 WebBrowser 控件在用户右击它时显示其快捷菜单.
webBrowser1.WebBrowserShortcutsEnabled = false;//将该控件的 WebBrowserShortcutsEnabled 属性设置为 false,以防止 WebBrowser 控件响应快捷键。
webBrowser1.ScriptErrorsSuppressed=true;//将该控件的 ScriptErrorsSuppressed 属性设置为 true,以防止 WebBrowser 控件显示脚本代码问题的错误信息。
View Code
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
    [System.Runtime.InteropServices.ComVisibleAttribute(true)]
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
        }
   
        private void button4_Click(object sender, EventArgs e)
        {
            this.webBrowser1.Navigate(this.textBox1.Text);
            this.webBrowser1.ObjectForScripting = this;
        }

        #region JavaScript中调用的方法
        public string InvokeFormMethod(string message)
        {
            MessageBox.Show(message);
            return "Charles2008";
        }
        #endregion

        #region 调用Javascript方法
        private void button6_Click(object sender, EventArgs e)
        {            
            this.webBrowser1.Document.InvokeScript("msgalert", new string[] { "Called from client code" });
        }
        #endregion
    }
View Code

猜你喜欢

转载自www.cnblogs.com/liuqifeng/p/9150130.html