0

我在下面的代码中收到以下错误:

预期的类、委托、枚举、接口或结构。

当悬停在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;
}
4

2 回答 2

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;
    }
}
于 2012-08-02T01:34:33.970 回答
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;
    }
}
于 2012-08-02T01:35:20.647 回答