同题

解决方案 »

  1.   

    up up up up up up up up up up up up up up up up up up up up up up up up up up up up up upup up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up up
      

  2.   

    在其它类中定义了可以传入结构体的类,例如myclass,还有结构体mystruct,然后
    MainForm mainForm = new MainForm();
    mystruct amystruct = new mystruct();
    myclass amyclass = new myclass(amystruct );
    .......
    Application.Run(mainForm );
      

  3.   

    //方法一,用静态变量:
    public class Class1
    {
    public static System.Drawing.Rectangle Rect;
    [STAThread]
    static void Main() 
    {
    Class1.Rect =new Rectangle(0,0,10,10);
    Class2 c2;
    c2=new Class2();
    Application.Run(new Form1());
    }
    }public class Class2
    {
    public Class2()
    {
    Console.WriteLine(Class1.Rect.ToString());
    }
    }
    //方法2,用参数传入
    public class Class1
    {
    private System.Drawing.Rectangle Rect; [STAThread]
    static void Main() 
    {
    Class1.Rect =new Rectangle(0,0,10,10);
    Class2 c2;
    c2=new Class2(Class1.Rect );
    Application.Run(new Form1());
    }
    }
    public class Class2
    {
    public Class2(System.Drawing.Rectangle r)
    {
    Console.Write(r.ToString());
    }
    }
      

  4.   

    //方法2,上面有的地方写错了
    public class Class1
    {
    private System.Drawing.Rectangle Rect;[STAThread]
    static void Main()
    {
    this.Rect=new Rectangle(0,0,10,10);
    Class2 c2;
    c2=new Class2(this.Rect );
    Application.Run(new Form1());
    }
    }
    public class Class2
    {
    public Class2(System.Drawing.Rectangle r)
    {
    Console.Write(r.ToString());
    }
    }
      

  5.   

    代码结构如下:public struct CommonVar
    {
      public string MyName;
    }public class MainForm : System.Windows.Forms.Form
    {
      public CommonVar commonVar;
      static void Main() 
      {
        LandForm loginform = new LandForm();
        loginform.ShowDialog();
        Application.Run(new MainForm());
      }
    }public class LandForm : System.Windows.Forms.Form
    {
      public  MainForm mainform;
      public void ConfirmButton_Click(object sender, System.EventArgs e)
      {
        //我是想在这里引用MainForm中的commonVar,但是就是不知道正确的表达方式
        this.mainform.commonVar.MyName="qiezi";
      }
    }
      

  6.   

    Brunhild()的方法可以,是偶菜原先没理解!
    谢谢楼上诸位!