建了一个Control,然后里面加了一个button和一个textbox,把编译后的dll嵌入IE中,然后向其传递参数,但是却显示不出来,为什么?
c#代码如下:
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;namespace WinFormControl
{
    public partial class WinFormGDICtrl : UserControl
    {
        private ArrayList m_arrayLines;
        private bool m_bDrawing;
        private string mtitle = "isNull";
        public string Title2
        {
            set
            {
                mtitle = value;
                button1.Text = mtitle;
                textBox1.Text = mtitle;
            }
            get
            {
                return mtitle;
            }
        }        public WinFormGDICtrl()
        {
            InitializeComponent();            //this.SetStyle(ControlStyles.UserPaint, true);
            //this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            //this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
            //this.MouseDown += new MouseEventHandler(WinFormGDICtrl_MouseDown);
            //this.MouseMove += new MouseEventHandler(WinFormGDICtrl_MouseMove);
            //this.MouseUp += new MouseEventHandler(WinFormGDICtrl_MouseUp);
            //this.Paint += new PaintEventHandler(WinFormGDICtrl_Paint);
            //m_arrayLines = new ArrayList();
            //m_bDrawing = false;
        }        void WinFormGDICtrl_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.FillRectangle(Brushes.Yellow, this.ClientRectangle);            foreach (Object obj in m_arrayLines)
            {
                LineObj m_lineObj = (LineObj)obj;
                m_lineObj.Draw(g);
            }
            g.DrawString(mtitle, new Font("Arial", 16), Brushes.Black, 10, 10);
        }        void WinFormGDICtrl_MouseUp(object sender, MouseEventArgs e)
        {
            m_bDrawing = false;
        }        void WinFormGDICtrl_MouseMove(object sender, MouseEventArgs e)
        {
            if (m_bDrawing)
            {
                LineObj m_lineObj = (LineObj)m_arrayLines[m_arrayLines.Count - 1];
                m_lineObj.m_endPoint = new Point(e.X, e.Y);
                this.Invalidate();
            }
        }        void WinFormGDICtrl_MouseDown(object sender, MouseEventArgs e)
        {
            LineObj m_lineObj = new LineObj(e.X, e.Y);
            m_arrayLines.Add(m_lineObj);
            m_bDrawing = true;
        }        private void button1_Click(object sender, EventArgs e)
        {
            button1.Text = mtitle;
        }
    }
}
html代码如下:
<html>
<head>
<title>测试</title>
</head>
<body>
<script language="javascript">
function Button3_onclick() {
    DrawTools.Title=Text1.value;
    Button2.value=DrawTools.Title;
}
</script
<object id="DrawTools" height="131" width="177" 
  classid="WinFormControl.dll#WinFormControl.WinFormGDICtrl" VIEWASTEXT>
</object><br/>
<input id="Button2" type="button" value="Button" 
         name="Button2" onclick="return Button3_onclick()"/>
<br/>
</body>
</html>

解决方案 »

  1.   

    http://www.cnblogs.com/oceanchip/archive/2005/06/11/172736.html
      

  2.   

    19public void OnInit(int num1,int num2) 
    20{ 
    21  BindDrp1(num1); 
    22  BindDrp2(num2); 
    23} 
     if(!Page.IsPostBack) 

                UserControl11.OnInit(10,20); 

      

  3.   

    Microsoft lost a lawsuit and now Internet Explorer is required to have the client click an ActiveX object before it can receive mouse and keyboard events.
      

  4.   

    这时在web 下用windows控件,有一个方法的,我试过几次,也问过很多人都没搞定。
    建议你找找“ie 下用windows控件”方面的资料看看啊。如果能使用了,请通知下我啊。
    hehe.
    email:[email protected]
      

  5.   

    to califord(远方):如何调试嵌入在IE里的控件?请指点
    to zhaochong12(超级大笨鸟):谢谢你提供的另一种使用winform的方法
    to jiangsheng(蒋晟.Net[MVP]);你提供的信息很有参考价值,谢谢。正在分析中
    to zhangshengsuibian(掌声随便):其实值是已经传递进去了的,因为如下代码可知:
    DrawTools.Title=Text1.value;
    Button2.value=DrawTools.Title;
    如果属性Title没有获得值的话,button2的值是应该是"isNull"字符串才对。
    也就是说,控件里的属性是可以直接通过javascript设置或获得的,这是参数传递的一种方法。
    问题是在我给出的那段代码中,我传递进去的参数显示不出来。点击button1,botton1.Text的值始终是"isNull",这才是我无法解决的地方。