gpt4 book ai didi

c# - 帮助覆盖 C# .NET

转载 作者:太空宇宙 更新时间:2023-11-03 19:30:17 25 4
gpt4 key购买 nike

我需要覆盖 Tabcontrol GetTabRect。

  protected override Rectangle GetTabRect(int index)
{...}

我收到这个错误

Error 1 'TabControl.GetTabRect(int)': cannot change access modifiers when overriding 'public' inherited member 'System.Windows.Forms.TabControl.GetTabRect(int)'

Error2'TabControl.GetTabRect(int)': cannot override inherited member 'System.Windows.Forms.TabControl.GetTabRect(int)' because it is not marked virtual, abstract, or override

我该怎么做?

编辑

如果我使用公共(public):

TabControl.GetTabRect(int)': cannot override inherited member 'System.Windows.Forms.TabControl.GetTabRect(int)' because it is not marked virtual, abstract, or override

最佳答案

该方法是公开的。所以当你覆盖它时,你不能让它受到保护。因此,您必须保持公众可见性。

它应该是这样的:

public override Rectangle GetTabRect(int index)

关于c# - 帮助覆盖 C# .NET,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5492686/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com