Preface: Why use IE to open WinForm personally think, WinForm deployment client too troublesome such as Kingdee · UF, Winfrom hit patch too troublesome, add new features and then deploy very time, so why not to use IE open it? This does not require deploying the client, the file update only needs to be done on the server. If you have an idea, you must realize it.
Benefits, WinForm stability, foreground control devpress completely meet the UI, do not need to write a lot of web foreground beautification code, more important development is very time-saving ...
----------------------------------------------------------------development environment: win7+vs2010
Web server: win2008 comes with a Web service program----------------------------------------------------<table id= ' Waiting ' style= ' width:100%; height:100%;p Osition:absolute; Visibility:hidden; Background: #ffffff; ' border= ' 0 ' cellspaceing= ' 0 ' cellpadding= ' 0 ' >
<tr>
<TD valign= ' Middle ' align= ' center ' >
<table border= ' 2 ' cellspacing= ' 2 ' height= ' >
<tr>
<TD align= ' center ' width= ' 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>
<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>
<body leftmargin= "3" topmargin= "3" marginwidth= "3" marginheight= "3" Overflow:hidden; >
<object classid= "maincontrollibrary.dll#maincontrollibrary.maincontrollibrary" height= "100%" width= "100%"/>
</body>
1. The above is the Web code (main.htm), parsing DLL files, note the last word, remember not syntax formatmaincontrollibrary.dll# Maincontrollibrary.maincontrollibrary----------------------------------------------------2. MainControlLibrary.dll how to generate Vs-c#-windowsformscontrollibrary3-usercontrol1.cs (page content added by itself)change WindowsFormsControlLibrary3 to MaincontrollibraryUserControl1 Change to Maincontrollibrary
-----------------------------------------------------
3.web Server Settingsconfiguration is not explained. Web site-default Web site--Add application-alias (Webdll)--Physical path (Web page and DLL file path)--OK
------------------------------------------------------4. Client IE SettingsTrusted Site--ip Address add--Custom Level--enable Activex all
win7. NET security settings cmd Run or save batch run, note to administrator permissions
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. Input in IEhttp://192.168.20.20/webdll/main.htm
Can manipulate the data like WinForm
--Complete-------------
------------------------------------------------------Follow-up discussion questions:1. Data transfer is also implemented with a Web server (SQL connection file is placed on the server)2. Adding menus dynamically3. Adding DLLs dynamically