繁体   English   中英

为什么是InitializeComponent(); 由于其保护级别而无法访问?

[英]Why is InitializeComponent(); inaccessible due to its protection level?

因此,这是我当前拥有的代码,并且出现错误:

由于其保护级别,无法访问“ SampleWindows.BaseWindow.InitializeComponent()”(CS0122)

有什么帮助吗?

using System;

namespace SampleWindows
{
    public class Form1 : BaseWindow
    {
        public Form1()
        {
            InitializeComponent();
            RoundedCorners(this.Height, this.Width);
        }
    }
}

这是因为InitializeComponent可能在BaseWindow中被标记为“私有”,但是在您的类Form1中,您尝试使用它。 您不能使用来自基类的标记为私有的方法/类成员。 尝试将其标记为“受保护”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM