2016-11-28 20 views
0
  1. 私はC#の開発autocadを使用したいと思います。私は新しいウィンドウフォームプロジェクトをビルドし、その上にボタンを追加します。
  2. 質問です:私は別のクラスに別のクラスのC#で別のメソッドを呼び出す方法

    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."); 
    } 
    

のメソッドを呼び出すためにクリックボタン下のコードを書きたい私が間違っているのか分かりません。

+0

「myMyCommands.Myds();」を使用する必要があるようです。あなたはその時点で何かを作ろうとはしていませんよね? –

答えて

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."); 

} 
関連する問題