

private void initializecomponent ( ) 
{
 this.groupbox1 = new system.windows.forms.groupbox ( ) ;
 this.txtusertext = new system.windows.forms.textbox ( ) ;
 this.label1 = new system.windows.forms.label ( ) ;
 this.groupbox1.suspendlayout ( ) ;
 this.suspendlayout ( ) ;
 this.groupbox1.controls.add ( this.txtusertext ) ;
 this.groupbox1.controls.add ( this.label1 ) ;
 this.groupbox1.location = new system.drawing.point ( 8 , 8 ) ;
 this.groupbox1.name = "groupbox1" ;
 this.groupbox1.size = new system.drawing.size ( 272 , 56 ) ;
 this.groupbox1.tabindex = 0 ;
 this.groupbox1.tabstop = false ;
 this.groupbox1.text = "visual studio .net創(chuàng)建的active x組件" ;
 this.txtusertext.enabled = false ;
 this.txtusertext.location = new system.drawing.point ( 84 , 20 ) ;
 this.txtusertext.name = "txtusertext" ;
 this.txtusertext.size = new system.drawing.size ( 180 , 21 ) ;
 this.txtusertext.tabindex = 1 ;
 this.txtusertext.text = "" ;
 this.label1.location = new system.drawing.point ( 8 , 24 ) ;
 this.label1.name = "label1" ;
 this.label1.size = new system.drawing.size ( 66 , 16 ) ;
 this.label1.tabindex = 0 ;
 this.label1.text = "輸入信息:" ;
 this.controls.add ( this.groupbox1 ) ;
 this.name = "mycontrol" ;
 this.size = new system.drawing.size ( 288 , 72 ) ;
 this.groupbox1.resumelayout ( false ) ;
 this.resumelayout ( false ) ;
}

public interface axmycontrol 
{
 string usertext { set ; get ; }
}
private string mstr_usertext ;
public string usertext
{
 get { return mstr_usertext ; }
 set 
 { 
  mstr_usertext = value ; 
  //修改組件的數(shù)值
  txtusertext.text = value ;
 }
}
using system ;
using system.collections ;
using system.componentmodel ;
using system.drawing ;
using system.data ;
using system.windows.forms ;
namespace activexdotnet
{
 public interface axmycontrol 
 {
  string usertext { set ; get ; }
 }
 /// <summary>
 /// mycontrol 的摘要說明。
 /// </summary>
 public class mycontrol : system.windows.forms.usercontrol , axmycontrol
 {
  /// <summary> 
  /// 必需的設(shè)計器變量。
  /// </summary>
  private system.componentmodel.container components = null ;
  private system.windows.forms.groupbox groupbox1 ;
  private system.windows.forms.label label1 ;
  private system.windows.forms.textbox txtusertext ; 
  private string mstr_usertext ;
  public string usertext
  {
   get { return mstr_usertext ; }
   set 
   { 
    mstr_usertext = value ; 
    //修改組件的數(shù)值
    txtusertext.text = value ;
   }
  }
  public mycontrol ( ) 
  {
   // 該調(diào)用是 windows.forms 窗體設(shè)計器所必需的。
   initializecomponent ( ) ;
   // todo: 在 initializecomponent 調(diào)用后添加任何初始化
  }
  /// <summary> 
  /// 清理所有正在使用的資源。
  /// </summary>
  protected override void dispose ( bool disposing ) 
  {
   if ( disposing ) 
   {
    if ( components != null ) 
    {
     components.dispose ( ) ;
    }
   }
   base.dispose ( disposing ) ;
  }
  #region 組件設(shè)計器生成的代碼
  /// <summary> 
  /// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器 
  /// 修改此方法的內(nèi)容。
  /// </summary>
  private void initializecomponent ( ) 
  {
   this.groupbox1 = new system.windows.forms.groupbox ( ) ;
   this.txtusertext = new system.windows.forms.textbox ( ) ;
   this.label1 = new system.windows.forms.label ( ) ;
   this.groupbox1.suspendlayout ( ) ;
   this.suspendlayout ( ) ;
   this.groupbox1.controls.add ( this.txtusertext ) ;
   this.groupbox1.controls.add ( this.label1 ) ;
   this.groupbox1.location = new system.drawing.point ( 8 , 8 ) ;
   this.groupbox1.name = "groupbox1" ;
   this.groupbox1.size = new system.drawing.size ( 272 , 56 ) ;
   this.groupbox1.tabindex = 0 ;
   this.groupbox1.tabstop = false ;
   this.groupbox1.text = "visual c#創(chuàng)建的active x組件" ;
   this.txtusertext.enabled = false ;
   this.txtusertext.location = new system.drawing.point ( 84 , 20 ) ;
   this.txtusertext.name = "txtusertext" ;
   this.txtusertext.size = new system.drawing.size ( 180 , 21 ) ;
   this.txtusertext.tabindex = 1 ;
   this.txtusertext.text = "" ;
   this.label1.location = new system.drawing.point ( 8 , 24 ) ;
   this.label1.name = "label1" ;
   this.label1.size = new system.drawing.size ( 66 , 16 ) ;
   this.label1.tabindex = 0 ;
   this.label1.text = "輸入信息:" ;
   this.controls.add ( this.groupbox1 ) ;
   this.name = "mycontrol" ;
   this.size = new system.drawing.size ( 288 , 72 ) ;
   this.groupbox1.resumelayout ( false ) ;
   this.resumelayout ( false ) ;
  }
  #endregion
 }
}
<html>
<body color = white>
<hr> 
<font face = arial size = 1>
<object id = "mycontrol1" name = "mycontrol1" classid = "activexdotnet.dll#activexdotnet.mycontrol" width = 288 height = 72 >
</object>
</font> 
<form name = "frm" id = "frm" >
<input type = "text" name = "txt" value = "請輸入數(shù)據(jù):" ><input type = button value = "確定" onclick = "doscript ( ) ; ">
</form>
<hr>
</body> 
<script language = "javascript">
function doscript ( )
{
 mycontrol1.usertext = frm.txt.value ;
}
</script>
</html>

新聞熱點
疑難解答
圖片精選