private cResult r;
public frmChild(cResult r):this()
{
this.r = r;
}
请问在这个代码中,所继承的this()是什么意思啊
谢谢了

解决方案 »

  1.   

    当生成一个frmChild的时候。自动生成一个cResult对象。且cResult对象被赋值为frmChild的r?!?!????
      

  2.   

    晚上的代码在这里,请高手解释下:this()意思
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;namespace WinParam
    {
    /// <summary>
    /// ChildForm 的摘要说明。
    /// </summary>
    public class frmChild : System.Windows.Forms.Form
    {
    private System.Windows.Forms.GroupBox groupBox1;
    private System.Windows.Forms.GroupBox groupBox2;
    private System.Windows.Forms.RadioButton optThree;
    private System.Windows.Forms.RadioButton optOne;
    private System.Windows.Forms.RadioButton optTwo;
    private System.Windows.Forms.TextBox txtResult2;
    private System.Windows.Forms.TextBox txtResult1;
    private System.Windows.Forms.Button cmdOk;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public frmChild()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } private cResult r; public frmChild(cResult r):this()
    {
    this.r = r;
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.groupBox1 = new System.Windows.Forms.GroupBox();
    this.optThree = new System.Windows.Forms.RadioButton();
    this.optOne = new System.Windows.Forms.RadioButton();
    this.optTwo = new System.Windows.Forms.RadioButton();
    this.groupBox2 = new System.Windows.Forms.GroupBox();
    this.txtResult2 = new System.Windows.Forms.TextBox();
    this.txtResult1 = new System.Windows.Forms.TextBox();
    this.cmdOk = new System.Windows.Forms.Button();
    this.groupBox1.SuspendLayout();
    this.groupBox2.SuspendLayout();
    this.SuspendLayout();
    // 
    // groupBox1
    // 
    this.groupBox1.Controls.Add(this.optThree);
    this.groupBox1.Controls.Add(this.optOne);
    this.groupBox1.Controls.Add(this.optTwo);
    this.groupBox1.Location = new System.Drawing.Point(8, 8);
    this.groupBox1.Name = "groupBox1";
    this.groupBox1.Size = new System.Drawing.Size(144, 104);
    this.groupBox1.TabIndex = 5;
    this.groupBox1.TabStop = false;
    this.groupBox1.Text = "修改父窗体值";
    // 
    // optThree
    // 
    this.optThree.Location = new System.Drawing.Point(16, 72);
    this.optThree.Name = "optThree";
    this.optThree.Size = new System.Drawing.Size(104, 16);
    this.optThree.TabIndex = 7;
    this.optThree.Text = "Show \"Three\"";
    this.optThree.CheckedChanged += new System.EventHandler(this.optThree_CheckedChanged);
    // 
    // optOne
    // 
    this.optOne.Location = new System.Drawing.Point(16, 24);
    this.optOne.Name = "optOne";
    this.optOne.Size = new System.Drawing.Size(104, 16);
    this.optOne.TabIndex = 6;
    this.optOne.Text = "Show \"One\"";
    this.optOne.CheckedChanged += new System.EventHandler(this.optOne_CheckedChanged);
    // 
    // optTwo
    // 
    this.optTwo.Location = new System.Drawing.Point(16, 48);
    this.optTwo.Name = "optTwo";
    this.optTwo.Size = new System.Drawing.Size(104, 16);
    this.optTwo.TabIndex = 5;
    this.optTwo.Text = "Show \"Two\"";
    this.optTwo.CheckedChanged += new System.EventHandler(this.optTwo_CheckedChanged);
    // 
    // groupBox2
    // 
    this.groupBox2.Controls.Add(this.txtResult2);
    this.groupBox2.Controls.Add(this.txtResult1);
    this.groupBox2.Location = new System.Drawing.Point(160, 8);
    this.groupBox2.Name = "groupBox2";
    this.groupBox2.Size = new System.Drawing.Size(136, 104);
    this.groupBox2.TabIndex = 6;
    this.groupBox2.TabStop = false;
    this.groupBox2.Text = "回传的结果";
    // 
    // txtResult2
    // 
    this.txtResult2.Location = new System.Drawing.Point(16, 64);
    this.txtResult2.Name = "txtResult2";
    this.txtResult2.TabIndex = 3;
    this.txtResult2.Text = "Result(2)";
    // 
    // txtResult1
    // 
    this.txtResult1.Location = new System.Drawing.Point(16, 32);
    this.txtResult1.Name = "txtResult1";
    this.txtResult1.TabIndex = 2;
    this.txtResult1.Text = "Result(1)";
    // 
    // cmdOk
    // 
    this.cmdOk.DialogResult = System.Windows.Forms.DialogResult.OK;
    this.cmdOk.Location = new System.Drawing.Point(224, 128);
    this.cmdOk.Name = "cmdOk";
    this.cmdOk.TabIndex = 7;
    this.cmdOk.Text = "确定(&O)";
    this.cmdOk.Click += new System.EventHandler(this.cmdOk_Click);
    // 
    // frmChild
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(304, 157);
    this.Controls.Add(this.cmdOk);
    this.Controls.Add(this.groupBox2);
    this.Controls.Add(this.groupBox1);
    this.Name = "frmChild";
    this.Text = "子窗体";
    this.groupBox1.ResumeLayout(false);
    this.groupBox2.ResumeLayout(false);
    this.ResumeLayout(false); }
    #endregion private void optOne_CheckedChanged(object sender, System.EventArgs e)
    {
    r.ChangeText("One");
    } private void optTwo_CheckedChanged(object sender, System.EventArgs e)
    {
    r.ChangeText("Two");
    } private void optThree_CheckedChanged(object sender, System.EventArgs e)
    {
    r.ChangeText("Three");
    } private void cmdOk_Click(object sender, System.EventArgs e)
    {
    r.Result1 = txtResult1.Text;
    r.Result2 = txtResult2.Text;
    }
    }
    }
      

  3.   


    private cResult r; public frmChild(cResult r):this()
    {
    this.r = r;
    }====
    public frmChild(cResult r)
    {
    InitializeComponent();
    this.r = r;
    }
      

  4.   

    cResult 是声名的类,现在问题是不知道this()是什么东西
    public delegate void TextChangedHandler(string s); public class cResult
    {
    public string Result1 = "";
    public string Result2 = "";

    public event TextChangedHandler TextChanged; public void ChangeText(string s)
    {
    if(TextChanged != null)
    TextChanged(s);
    }
    }
      

  5.   

    public frmChild()
    {
    InitializeComponent();
    }
    public frmChild(cResult r):this()
    {
    this.r = r;
    }---->public frmChild()
    {
    InitializeComponent();
    }
    public frmChild(cResult r)
    {
    InitializeComponent();
    this.r = r;
    }