2012-08-02 96 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; 
    } 
} 
相关问题