2012-08-02 81 views
0

我得到下面的代碼以下錯誤:錯誤:預期類,委託,枚舉,接口或結構

expected class,delegate,enum,interface or struct.

GH_ObjectResponse徘徊發生這種情況時,我究竟做錯了什麼?

public class SettingsComponentAttributes : GH_ComponentAttributes 
{ 
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : 
     base(SettingsComponent) {} 
} 

public override GH_ObjectResponse RespondToMouseDoubleClick(
    GH_Canvas sender, GH_CanvasMouseEvent e) 
{ 
    ((SettingsComponent)Owner).ShowSettingsGui(); 
    return GH_ObjectResponse.Handled; 
} 

回答

5

你的方法不是在類中聲明...試試這個來代替:

public class SettingsComponentAttributes : GH_ComponentAttributes 
{ 
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) { } 

    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) 
    { 
     ((SettingsComponent)Owner).ShowSettingsGui(); 
     return GH_ObjectResponse.Handled; 
    } 
} 
1

注意你的括號內。它應該是:

public class SettingsComponentAttributes : GH_ComponentAttributes 
{ 
    public SettingsComponentAttributes(IGH_Component SettingsComponent) : base(SettingsComponent) {} 

    public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e) 
    { 
     ((SettingsComponent)Owner).ShowSettingsGui(); 
     return GH_ObjectResponse.Handled; 
    } 
} 
相關問題