我首先写了一个C#的窗体程序:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }        private void Form1_Load(object sender, EventArgs e)
        {
            
        }        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics; //创建画板
            Pen p = new Pen(Color.Blue, 2);//定义了一个蓝色
            System.Drawing.Image img1 = System.Drawing.Image.FromFile(@"C:\Users\YU\Desktop\1.jpg");
            System.Drawing.Image img2 = new Bitmap(800, 600, PixelFormat.Format24bppRgb);
            g.DrawImage(img1, 0, 0);
            g.DrawImage(img2, 0, 0);
            g.DrawLine(p, 10, 10, 100, 100);//在画板上画直线
            g.DrawRectangle(p, 10, 10, 100, 100);//在画板上画矩形
            g.DrawEllipse(p, 10, 10, 100, 100);//在画板上画椭圆
        }
    }
}之后把上面的程序编译成一个dll文件,文件名为WindowsFormsApplication1.dll然后新建了一个html页面:
<html>
<head>
<title>C#窗体</title>
</head>
<body>
<object id="t" classid="WindowsFormsApplication1.dll#WindowsFormsApplication1.Form1"height="600" width="800" VIEWASTEXT>
</object>
</body>
</html>然后把html页面和WindowsFormsApplication1.dll放在同一个目录下,直接点击打开网页。但是c#的窗体程序没有被运行,只是在网页中出现了一块800*600大小并且左上角带有一个小叉的区域。哪位高手能帮我解决一下啊。谢谢!