2016-11-28 3 views
0
  1. aufrufen Ich möchte C# entwickeln, autocad und ich ein neues Windows-Formular-Projekt erstellen und fügen Sie eine Schaltfläche hinzu, ich werde den Parameter in das Formular einfügen.
  2. Die Frage ist: I-Code unter der Klick-Taste schreiben möchten die Methode in einer anderen Klasse zu nennenwie eine andere Methode in C# in einer anderen Klasse

    private void guocheng1_Click(object sender, EventArgs e) 
    { 
        MyCommands myMyCommands = new MyCommands(); 
    
        MyCommands.Myds = new Myds() ; 
    } 
    
    
    public void Myds() // This method can have any name 
    { 
        // Put your command code here 
        Document doc = Application.DocumentManager.MdiActiveDocument; 
        Database db = doc.Database; 
        Editor ed = doc.Editor; 
        ed.WriteMessage("\r\nThis is an Initialization Startup text."); 
    } 
    

Ich weiß nicht, was los ist.

+0

Es sieht so aus, als sollten Sie nur 'myMyCommands.Myds();' verwenden. Du versuchst zu diesem Zeitpunkt nichts zu konstruieren, oder? –

Antwort

1
private void guocheng1_Click(object sender, EventArgs e) 
    { 
     MyCommands myMyCommands = new MyCommands(); 

     myMyCommands.Myds() ; //this, its not a static method. Also, this is how you call a method. 
    } 

public void Myds() // This method can have any name 
{ 
    // Put your command code here 
    Document doc = Application.DocumentManager.MdiActiveDocument; 
    Database db = doc.Database; 
    Editor ed = doc.Editor; 
    ed.WriteMessage("\r\nThis is an Initialization Startup text."); 

} 
Verwandte Themen