zoukankan      html  css  js  c++  java
  • webBrowser 设置文本框

    private void Form1_Load(object sender, EventArgs e)
            {
                this.webBrowser1.Navigate("http://www.baidu.com");
                this.webBrowser1.ScriptErrorsSuppressed = true;
                //禁用右键菜单
                this.webBrowser1.IsWebBrowserContextMenuEnabled = false;
                //禁用键盘快捷键
                this.webBrowser1.WebBrowserShortcutsEnabled = false;
                //打开IE打印机会话框
                this.webBrowser1.ShowPrintDialog();
                //打开IE的打印预览会话框
                this.webBrowser1.ShowPrintPreviewDialog();
                //打开IE的保存 会话框
                this.webBrowser1.ShowSaveAsDialog();
               
            }

    #region 设置网页字段
            /// <summary>
            /// 设置网页字段
            /// </summary>
            /// <param name="strInput"></param>
            private void SetHtmlElementValue(string strInput)
            {
                try
                {
                    Clipboard.Clear();
                    Clipboard.SetDataObject(strInput);
                    IDataObject elementData = Clipboard.GetDataObject();
                    if (elementData.GetDataPresent(DataFormats.Text))
                    {
                        HtmlElement elem = this.webBrowser1.Document.ActiveElement;
                        elem.SetAttribute("value", strInput);
                    }
                    return;
                }
                catch (Exception ex)
                { }
            }

            #endregion

    private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
            {
                SetHtmlElementValue("aaaaaaaaaaa");
            }

  • 相关阅读:
    iOS加载HTML, CSS代码
    iOS搜索指定字符在字符串中的位置
    【解决方法】You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)
    刷新指定行或区 cell
    支付宝获取私钥和公钥
    什么是Git?
    第三方库AFNetworking 3.1.0的简单使用
    转:KVC与KVO机制
    转:常用的iOS开源库和第三方组件
    转:setValue和setObject的区别
  • 原文地址:https://www.cnblogs.com/jcgh/p/2013998.html
Copyright © 2011-2022 走看看