2. 如何在子窗体中调用主窗体中的某某方法;
 //Define two delegate methods to get or set textbox value in main form
public delegate void SetTextValue( string TextValue );
public delegate string GetTextValue(  );// In sub-form class
 // Handler for methods from main form
    private SetTextValue SetText = null;
    private GetTextValue GetText = null;    // Call methods as follows
string strValue = GetText();
SetText( strValue + DateTime.Now.ToString() ); 除了如上一些操作外,还需要修改子窗体的构造函数,来接收这两个delegate方法,这里就不多说了。 至于主窗体,首先要为这两个委托来实现对应函数,例如:
    private string GetValue()
    {
        return yourTextBox.Text;
    }    private void SetValue( string sValue )
    {
        yourTextBox.Text = sValue;
    } 那么调用子窗体的时候就比较简单了。
// Create subform and show it
 yourSubForm myForm = new yourSubForm( 
        new SetTextValue( SetValue ),
        new GetTextValue( GetValue ) );
    myForm.ShowDialog();