I am wondering how to build a C # applet. I built a class library with a custom control. But the browser (IE6) fails to render it as object. Do your have some examples to show how to achieve this? By the way, can a C # applet be run under platforms without the. NET Framework pre-installed?
There ' s no such concept as a C # "applet". At most, there are custom Windows forms controls this are embedded on a page. Of course, just like in Java, and can ' t run it if you don ' t have the corresponding runtime on the client machine. can use the <object> tag to add it to a HTML page: (zzj0820 Note: There is actually no concept of the so-called C # applet, which is usually referred to as a form control embedded in the browser 。 Of course, like Java, the appropriate Run-time libraries must be installed on the client machine to use an object label control embedded in an HTML page.
The class ID contains the URL of the DLL for downloading and the fully qualified name of the class that implements the con Trol. The library must not is placed on The/bin folder of a WEB application in order to is served by iis/asp.net
Here are two simple examples that will help J
EG1: Original link
/*
* A simple C # program which displays some text in A webpage.
public class HelloWorldApplet:System.Windows.Forms.Control {
Public Helloworldapplet () {
Create a "label" control
Label label = new label ();
Label. Text = "Hello world!";
Label. ForeColor = Color.Blue;
Label. Font = new Font ("Arial", fontstyle.bold);
Label. AutoSize = true;
Insert the label
Controls.Add (label);
}
}
EG2: Original link
C # applets
by Lloyd Dupont
I want to tell you the I-write C # Applet, display it in a Web page and the requirement.
The requirement-your C # Applet won ' t work anywhere nor from anywhere. Should put (and test) it in IIS, for unknown reason (in last unknown to me) This won ' t work locally or with Apache. BTW http://www.brinkster.com make free ". NET" Hosting.
Not any client could display a C # Applet, surely need IE6 and probably. NET SDK (at last with these configuration Work everywhere I know).
After your wrote your custom System.Windows.Forms.Control, create it with a parameterless constructor (which'll be called by IE) and wrap it in a assembly.
After you could display it very easily the Web page like this:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.