Firstly, the article "Use Windows Form Control" in Internet Explorer "in Internet Explorer: (If some of the information references cannot be displayed properly, please click on the link above) This topic describes how to describe how to in Internet Explorer The Windows Form Control is successfully performed within IE. The Windows Form Control within IE can be activated without user tips, which does not require registration, and uses the public language runtime (CLR) code access security. The Windows Form Control is activated in Internet Explorer. It takes five steps, which lists each step and is described in detail below.
Create a Windows Form Control. Create an HTML document with an Object tag. Create a virtual directory and set permissions. Run the control. Creating a Windows Form Control Almost any Windows Form Control in Internet Explorer, but for this example, we will carry the SimpleControl included in the Create Control section of this Quick Start Tutorial. This control must be installed into the global program cache or in the same virtual directory with the web page containing it. Creating an HTML document with an Object tag Next is to create an HTML document with an Object tag that references the Windows Form Control. For this example, some simple scripts and input tags will also be added to demonstrate program access to the control.
ClassID = "http: simplecontrol.dll # microsoft.samples.winforms.cs.simplecontrol.simplecontrol"
Height = "300" width = "300" Viewastext>
Object>
ClassID has two interested parts: pointing to the path of the control library and the fully qualified name of the control, both by # 号. If you are familiar with the ActiveX Object tag, you will notice the lack of a GUID. In the Windows Form, the combination of the path and the fully qualified class name is a unique identifier. PARAM tag can be used to set properties on the control. In this case, the Name characteristic is the name of the attribute, and the value characteristic is the value of the attribute.
Function ChangeText () {
SimpleControl1.Text = Text1.Value;
}
script>
? -
To get program access to the control, you can write scripts for the control. Use the buttons and text boxes on this page to use the simple JScript function ChangeText to set the TEXT attribute of the control. Here is the complete HTML and script code of this example.
Function ChangeText () {
SimpleControl1.Text = Text1.Value;
}
script>
Simple Control
body>
ClassID = "http: simplecontrol.dll # microsoft.samples.winforms.cs.simplecontrol.simplecontrol"
Height = "300" width = "300" Viewastext>
Object>
html>
Creating a virtual directory and setting permissions The HTML page must reside in the IIS virtual directory on the web server, and must have appropriate permissions. In this example, the Windows Form Control resides in the same directory, but it can also be installed into the global program cache. The execution permissions on the virtual directory must be set to Scripts, and if the permission is set to Scripts & Executables, the control will not be activated correctly. These steps have been performed for this example. Running the control To run the control, simply point Internet Explorer to the HTML page in the virtual directory. If the control is not activated correctly, you may need to restart Internet Explorer. //// The reference ended from my last time I last read MSDN WEBEXC activity, Xiao Chen in WebCast_asp.net_2 (that is, ASP.NET Skill 2) Demonstrate the so-called Smart Client in the Window program in the web page (I don't know Is there a word that is wrong?), I will always sleep. What? And I always repeatedly read the two original code of Xiao Chen's open code: that, Xiao Chen's code is in the article referenced above: object> can be said to be the same. In the past, I didn't pay very attention to the article of Window Forms to get started with quick start. I remember that I have seen those articles. But I have always developed B / S mainly, so even if I haven't used it, I have forgotten it. // The words are exactly the same as the sample code of the quick start. Success! I feel special excitement in my heart, even if I have, I have to continue. I started to do myself ... I first put it up, putting a form written in a normal situation. I can't show up, I am dizzy. Why can't you show it? I am also done above! I have seen my code several times, it's right, but it is no play. // I will find it later, the form can't be put, but only put the pieces, please refer to the programs of the last demonstration: this picture (left WEB, left is Window) You will find that the Window Form in the small way present is a little bit different from the Web: it is a "Game" menu on WinOW. So it is a form file (you can't put the mainMenu control on the control). Instead of control. The one below the menu is. So it can be separated to put it on the web (it should be a user control or custom control on the web. I originally thought that Xiao Chen was put on. It is an application's main () function boot. I said that a form file cannot be put. Or all the documents inherited from form do not put it. (I still don't know. I have been engaged in b / s. Oh, after putting the form file, I tried to put the controls many times. I don't talk much to the failure. I put some things that may be useful for everyone to share. 1. Here I suggest that everyone will play with "User Controls": It is more convenient to use it. The operation of the self-discipline control is not visible. However, as long as it is a control. 2.
Part of the code in the control code is deleted! A new member user near default code is: using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace WindowsApplication3 {/// / Summary of // UserControl1. /// summary> public class userControl1: system.windows.Forms.userControl {/// // The designer variable is required. /// summary> private system.componentmodel.container components = null; // Need to delete public userControl1 () {// This call is required for Windows.Forms Form Designer. InitializationComponent (); // Todo: Add any initialization after the initializationComponent call} /// /// Clean all the resources being used. /// summary> Protected Override Void Dispose (Bool Disposing) {if (disponents! = null) {components.dispose ();}} base.dispose (Disposing);} // This method needs Deleting the #REGION component designer generated code /// /// designer supports the required method - do not use the code editor // to modify the contents of this method. /// summary> private () {components = new system.componentmodel.container (); // Need to delete, but you will not be able to pull a control in the designer. } #Endregion}} If you don't remove it, you will not be able to run properly on the web. After removing the code: using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace WindowsApplication3 {/// /// UserControl1 Summary Description. /// summary> public class userControl1: system.windows.Forms.userControl {/// // The designer variable is required. /// summary> public userControl1 () {// This call is required for the Windows.Forms Form Designer. InitializationComponent (); // Todo: Add any initialization} #Region component designer generated after InitializationComponent Call after INITIALIZECOMPONENT Call This method is content.
/// summary> private ()} #ENDREGONNENT ()} #ENDREGON}} The reason I don't understand. However, if the resource is cleaned, I think the control is loaded after the WEB's cache. Oh, turn off. The data in the cache is not // I am not familiar with Windows, so it may be very wrong:) 3. The Window control on the web cannot run in XP style (perhaps, but I haven't played for a long time. After all, I am a Window line. Whoever makes it must be posted) 4. No matter whether it is compiled into .exe or .dll files can be. Ok, now we start to make a try. New C # window project, the name is just taken, I took a: smartclient1 project in the form1.cs file, you don't like it, you can delete it. I deleted it. Then create a user control: UserControl1.cs file. I will pull a control from it. I pulled a Button control. Then I changed the background color of the background color and control. All code is as follows: using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; namespace SmartClient1 {/// /// summary of UserControl1 . /// summary> public class userControl1: system.windows.Forms.userControl {private system.windows.forms.button button1; /// // / / / The necessary designer variables. /// summary> public userControl1 () {// This call is required for the Windows.Forms Form Designer. InitializationComponent (); // Todo: Add any initialization} #Region component designer generated after InitializationComponent Call after INITIALIZECOMPONENT Call This method is content.
/// summary> private void initializecomponent () {this.button1 = new system.windows.Forms.Button (); this.suspendlayout (); // // button1 // this.button1.backcolor = system.drawing .Color.teal; this.button1.location = new system.drawing.point (352, 112); this.button1.name = "button1"; this.button1.tabindex = 0; this.button1.text = "button1" ; // UserControl1 // this.backcolor = system.drawing.color = system.drawing.color.paleturquoise; this.Controls.add (this.button1); this.name = "UserControl1"; this.size = new system.drawing.size 456, 150); this.ResumeLayout (false);} #ENDREGON}} It's better to compile. (I am programming it into a DLL file) Next, we will build an HTML page that calls it. Before I built, I set a folder on the D disk and set this folder in IIS to a virtual directory: "smartclient". Then create an A.htm file and a "bin" folder in the new folder I just created (to let me put the good DLL file). Then reap into this "bin" folder. The code of the A.htm file is as follows:
Window control in Web Trial title> head> Object> body> html> // http: bin / smartclient1.dll # smartclient1.userControl1 Meaning, I have instructions in the referenced file, everyone can refer to. And I have just seen it. All right. You can now open "http://localhost/smartclient/a.htm" to try :) The effect picture is as follows: Now we will go to a little more content: New a form file, put the form file through the button control Point out. (I just deleted form1.cs, I had to rebuild one.) The code is basically no change. Just add a click event for Button1: this.button1.click = new system.eventhandler (this.button1_click); private void button1_click (Object sender, system.eventargs e) {new form1 (). Show ();} The new form file I didn't add anything, I didn't decrease. So it will not put the code here. Compile it again. Cap over the DLL file. Remember to delete the original first. Or cover it. Then turn off the original web page.
Because the DLL changed a web page, you must clean up the original cache. So get a new open IE. Open the new IE. Don't choose the intelligent display to your historical address in the address bar. In that, you just load the original control because it remains in the historical cache. Ok, try now! Successful. I put the button, the Window form appeared (what do you think this means?). The effect is as follows: I don't talk about the smart client at the developer conference. But there is a small problem in it (I also said in an article I have seen last time). I told me. Just when you are in the Web. EXE file, you will be downloaded to get the download list. And you can only delete the download tool :) Through me, I will use a control on the Web to run in a Window approach, maybe you can try it. That is to do a top-saving control on the Web to launch this system. You can start a form, you can also start an EXE thread (I haven't tried it in the web, and I have forgot how to start, so I have no way before this). As for .NET Framework security configuration. Because there are some very good articles on the Internet. I didn't talk, and I also said in the document referenced above. I will post them in my bolg. For the first time, it is very embarrassed. I don't know how to get it :) Author Blog:
http://blog.9cbs.net/cwzb/