¡¡¡¡ÔÚ±àÂëÖв»¿É·ñÈϵ÷ÓÃActive»á¸ø±à³Ì´øÀ´ºÜ´ó±ãÀû£¬ËäȻ΢Èí²»Ì«Ö»³Ö.netµ÷ÓÃActive ×é¼þ¡£ ±¾ÊµÀýÊÇÒ»¸ö¼òµ¥Web Ò³Ãæµ÷ÓÃActive×é¼þµÄÀý×Ó£¬ÊµÏÖ°ÑÊý¾Ý´«Èë²¢ÏÔʾÔÚactive×é¼þÀïµÄ¿Ø¼þÖС£ ¡¡¡¡ÊµÀý´úÂëÈçÏ£º £±¡¢½¨Á¢Active×é¼þ£¨ÕâÀïÓÃ.net¡¡c#´´½¨£© £¨±¾³ÌÐòÖУº½¨Á¢Àà¿âÌí¼Ó×é¼þÀàºóÍзţºlabel ¡¢ button ¡¢groupBox¸÷Ò»¸ö£© ¡¡¡¡¡¡ÐèҪעÒâµÄÊÇÔÚÉú³É.dll֮ǰһ¶¨ÒªÔÚÀà¿âµÄAssemblyInfo.csÖмÓÈëÒýÓÃusing System.Security;ºÍÊôÐÔ[assembly : AllowPartiallyTrustedCallers()]£¬ÕâÊÇΪÁ˸ø¿Ø¼þ¸³Óè×ã¹»µÄȨÏÞʹËüÄÜÔÚÒ³ÃæÉÏÏÔʾ¡£ using System; using System.ComponentModel; using System.Collections; using System.Diagnostics; using System.Windows.Forms ; namespace ActiveXDotNet { /**//// <summary> /// AbeenControl µÄժҪ˵Ã÷¡£ /// </summary> public class AbeenControl : System.Windows.Forms.UserControl { private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button1; private System.Windows.Forms.GroupBox groupBox1; /**//// <summary> /// ±ØÐèµÄÉè¼ÆÆ÷±äÁ¿¡£ /// </summary> private System.ComponentModel.Container components = null; public string LabelText { get { return this.label1.Text.ToString(); } set { this.label1.Text=value; } } public AbeenControl(System.ComponentModel.IContainer container) { /**//// /// Windows.Forms Àà׫дÉè¼ÆÆ÷Ö§³ÖËù±ØÐèµÄ /// this.label1.Text="test"; container.Add(this); InitializeComponent(); // // TODO: ÔÚ InitializeComponent µ÷ÓúóÌí¼ÓÈκι¹Ô캯Êý´úÂë // } public AbeenControl() { /**//// /// Windows.Forms Àà׫дÉè¼ÆÆ÷Ö§³ÖËù±ØÐèµÄ /// InitializeComponent(); // // TODO: ÔÚ InitializeComponent µ÷ÓúóÌí¼ÓÈκι¹Ô캯Êý´úÂë // } /**//// <summary> /// ÇåÀíËùÓÐÕýÔÚʹÓõÄ×ÊÔ´¡£ /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } ×é¼þÉè¼ÆÆ÷Éú³ÉµÄ´úÂë#region ×é¼þÉè¼ÆÆ÷Éú³ÉµÄ´úÂë /**//// <summary> /// Éè¼ÆÆ÷Ö§³ÖËùÐèµÄ·½·¨ - ²»ÒªÊ¹ÓôúÂë±à¼Æ÷ÐÞ¸Ä /// ´Ë·½·¨µÄÄÚÈÝ¡£ /// </summary> private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(16, 24); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(296, 23); this.label1.TabIndex = 0; this.label1.Text = "label1"; // // button1 // this.button1.Location = new System.Drawing.Point(120, 56); this.button1.Name = "button1"; this.button1.TabIndex = 1; this.button1.Text = "button1"; this.button1.Click += new System.EventHandler(this.button1_Click); // // groupBox1 // this.groupBox1.Controls.Add(this.label1); this.groupBox1.Controls.Add(this.button1); this.groupBox1.Location = new System.Drawing.Point(0, 0); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(320, 88); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "groupBox1"; // // AbeenControl // this.Controls.Add(this.groupBox1); this.Name = "AbeenControl"; this.Size = new System.Drawing.Size(328, 96); this.Load += new System.EventHandler(this.AbeenControl_Load); this.groupBox1.ResumeLayout(false); this.ResumeLayout(false);
} #endregion private void button1_Click(object sender, System.EventArgs e) { this.label1.Text="µã»÷Íê³É£¡"; } private void AbeenControl_Load(object sender, System.EventArgs e) { } } } £²¡¢web¡¡Ò³Ãæµ÷ÓÃActive×é¼þ ¡¡¡¡×¢ÒâwebÒ³Ãæµ÷ÓÃʱÐèÒª°ÑActiveµÄ.dll·Åµ½webµÄÐéÄâҪĿ¼Ï¡£ <HTML> <HEAD> <title>TestActive</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="javascript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body > <font face="arial" size="1"> <OBJECT id="MyControl1" name="MyControl1" classid="http://localhost/WebApplication1/ActiveXDotNet.dll#ActiveXDotNet.AbeenControl" width="288" height="72" VIEWASTEXT> </OBJECT> </font> <form id="frm" name="frm"> <input type="text" name="txt" value="ÇëÊäÈëÊý¾Ý£º" ID="Text1"> <input type="button" value="È·¶¨" onclick="doScript();" ID="Button1" NAME="Button1"> <script type="text/javascript"> function doScript() { MyControl1.LabelText=frm.txt.value; } </script> </form> </body> </HTML>
|