前言:为什么要用ie打开winform
个人觉得,winform部署client太麻烦如金蝶··用友,winfrom打补丁太麻烦,加入新功能再部署很费时间;于是就想为什么不能用IE打开呢?这样就不须要部署client,文件更新仅仅须要在server做。有想法就一定要实现。。
优点。winform稳定。前台控件devpress全然满足UI,不须要写大量的WEB前台美化代码。更重要的开发很省时间。
。。。。
。
----------------------------------------------------------------
开发环境: win7+vs2010
webserver:win2008 自带web服务程序
----------------------------------------------------
<table id='waiting' style='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.webserver设置
配置不做解说。
站点-Default web site --加入应用程序-别名(webdll)--物理路径(web网页和dll文件路径)--确定
------------------------------------------------------
4. clientIE 设置
收信任的网站 --ip地址加入--自己定义级别--所有启用 Activex
win7 .net安全设置 cmd 执行 或者保存批处理执行。注意要管理员权限
C:WINDOWSMicrosoft.NETFrameworkv2.0.50727caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFramework64v4.0.30319caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFrameworkv2.0.50727caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFramework64v4.0.30319caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFramework64v4.0.30319caspol.exe -q -rg "1"
C:WINDOWSMicrosoft.NETFrameworkv2.0.50727caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFrameworkv4.0.30319caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFramework64v2.0.50727caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:WINDOWSMicrosoft.NETFramework64v4.0.30319caspol -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.传输数据也用webserver实现(sql连接文件放在server上)2.动态加入菜单
3.动态加入dll