web顯示winform,web開啟winform,IE開啟winform

來源:互聯網
上載者:User

標籤:web   .net   c#   

前言:為什麼要用ie開啟winform 個人認為,winform部署用戶端太麻煩如金蝶··用友,winfrom打補丁太麻煩,添加新功能再部署非常費時間;於是就想為什麼不能用IE開啟呢?這樣就不需要部署用戶端,檔案更新只需要在伺服器做。有想法就一定要實現。。
好處,winform穩定,前台控制項devpress完全滿足UI,不需要寫大量的WEB前台美化代碼,更重要的開發非常省時間。。。。。。
----------------------------------------------------------------開發環境: win7+vs2010   
web伺服器:win2008  內建web服務程式 ----------------------------------------------------<table id=‘waiting‘ style=‘width:100%; height:100%;position:absolute; visibility:hidden; background:#ffffff;‘ border=‘0‘ cellspaceing=‘0‘ cellpadding=‘0‘>
 <tr>
     <td valign=‘middle‘ align=‘center‘>
         <table border=‘2‘ cellspacing=‘2‘ height=‘50‘>
             <tr>
                 <td align=‘center‘ width=‘400‘ style=‘font-size:12pt; background:#ffffff;‘>
                     <b><font color=‘blue‘>Loading...</font></b>
                 </td>
             </tr>
         </table>
     </td>
 </tr>
</table>
<script language=‘Javascript‘> waiting.style.visibility=‘visible‘ </script>
<html>
<head>
<link rel="shortcut icon" href="swerp.ico">
<title>⑵⑵ SuHe SYSTEM ⑵⑵</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
/*
body  {
scrollbar-shadow-color: #ffffff;
scrollbar-highlight-color: #ffffff;
scrollbar-face-color: #d9d9d9;
scrollbar-3dlight-color: #d9d9d9;
scrollbar-darkshadow-color: #d9d9d9;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #ffffff;

}
*/
html, body { overflow:hidden; }

</style>

<script language="text/javascript">
function window.onload()
  {
      try
      {
          if (document.all.waiting != null)
          {
              document.all.waiting.style.visibility = "hidden";
              document.all.waiting.style.height = "0px";
          }
      }
      catch(e)
      {
          alert(e.name + "[Load] : " + e.message);
          
          if (document.all.waiting.style.height != "0px")
          {
              document.all.waiting.style.visibility = "hidden";
              document.all.waiting.style.height = "0px";
          }
      }
  }
</script>

</head>
<body  leftmargin="3" topmargin="3" marginwidth="3" marginheight="3"  overflow:hidden; >
<object  classid="MainControlLibrary.dll#MainControlLibrary.MainControlLibrary" height="100%" width="100%"/> 
</body>

</html>----------------------------------------------------1. 以上是網頁代碼(main.htm),解析 dll檔案 ,注意最後一句話 ,切記別文法格式MainControlLibrary.dll#MainControlLibrary.MainControlLibrary----------------------------------------------------2. MainControlLibrary.dll   如何產生   vs-C#-WindowsFormsControlLibrary3-UserControl1.cs  (頁面內容自己添加)將    WindowsFormsControlLibrary3    改為     MainControlLibrary             UserControl1   改為    MainControlLibrary


-----------------------------------------------------
3.web伺服器設定 配置不做講解。 網站-Default web site  --添加應用程式-別名(webdll)--實體路徑(web網頁和dll檔案路徑)--確定




------------------------------------------------------4. 用戶端IE 設定 收信任的網站 --ip地址添加--自訂層級--全部啟用 Activex
win7 .net安全設定  cmd 運行  或者儲存批處理運行,注意要管理員權限

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1 
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1 
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1 
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1 




--------------------------------------------------------5. ie中輸入 http://192.168.20.20/webdll/main.htm        
   可以和winform一樣操作資料  
-------完成-------------


------------------------------------------------------後續探討問題:1.資料轉送也用web伺服器實現(sql串連檔案放在伺服器上)2.動態添加菜單3.動態添加dll 



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.