I want to tell you how to write C# Applet, display it in a web page and the requirement.
The requirement first, your C# Applet won't work anywhere nor from anywhere. You should put (and test) it on IIS, for unknown reason (at 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, you surely need IE6 and probably .NET SDK (at last with these configuration this work everywhere i know).
After you wrote your custom System.Windows.Forms.Control, create it with a parameterless constructor (which will be called by IE) and wrap it in an assembly.
After you could display it very easily in a web page like this:
and with id you could call it public method vis javascript like this
source
-- un.cs --
using System;
using System.Drawing;
using System.Windows.Forms;
// csc un.cs
// csc /t:library /out:Un.DLL un.cs
namespace WT
{
public class T : Control
{
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.FillRectangle(new SolidBrush(Color.Azure), ClientRectangle);
e.Graphics.DrawLine(Pens.DarkSalmon,
new Point(0, 0),
new Point(ClientRectangle.Width, ClientRectangle.Height));
}
public static void Main(string[] m)
{
Form f = new Form();
T t = new T();
t.Dock = DockStyle.Fill;
f.Controls.Add(t);
Application.Run(f);
}
}