乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      WPF界面添加WinForm的Webbrowser控件

       風(fēng)中Robin 2012-06-21

      1.添加引用:

        WindowsFormsIntegration.dll

        System.Windows.Forms.dll

        2.頁(yè)面代碼:

          <Window x:Class="Demo.MainWindow"  
              xmlns=
      "http://schemas.microsoft.com/winfx/2006/xaml/presentation"  
              xmlns:x=
      "http://schemas.microsoft.com/winfx/2006/xaml"  
              Title=
      "MainWindow" Height="378" Width="620" Loaded="Window_Loaded" >  
          <Grid Name="grid">         
          </Grid>  
          </Window>  

        3.后臺(tái)代碼:

           System.Windows.Forms.Integration.WindowsFormsHost host =  
                      new System.Windows.Forms.Integration.WindowsFormsHost();  
                  
               System.Windows.Forms.WebBrowser web = new System.Windows.Forms.WebBrowser();  
                 
               web.Url = new Uri("http://www.baidu.com");  
                    
               host.Child = web;  
                  
               this.grid.Children.Add(host);  

        防止彈出新的頁(yè)面,所有的頁(yè)面只能在webbrowser控件中顯示。

        代碼如下:

        【將所有的連接都指向本窗體】

          private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)   
          {    
              //將所有的鏈接的目標(biāo),指向本窗體     
              foreach (HtmlElement archor in this.webBrowser.Document.Links)    
              {    
                  archor.SetAttribute("target""_self");    
              }    
           
        
              //將所有的FORM的提交目標(biāo),指向本窗體     
              foreach (HtmlElement form in this.webBrowser.Document.Forms)    
              {    
                  form.SetAttribute("target""_self");    
              }    
        
          }   

        【取消新窗口事件】

          private view sourceprint?private void webBrowser1_NewWindow(object sender, CancelEventArgs e)    
          {    
               e.Cancel = true;    
          } 

        將 WebBrowser 的 AllowWebBrowserDrop 設(shè)為 false(禁止拖放)

        將 WebBrowser 的 WebBrowserShortcutsEnabled 設(shè)為 false(禁止使用快捷鍵)

        將 WebBrowser 的 IsWebBrowserContextMenuEnabled 設(shè)為 false(禁止右鍵上下文菜單)

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多