Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在.Net Framework C#中显示类的属性?_C#_.net_Winforms_Frameworks_Components - Fatal编程技术网

如何在.Net Framework C#中显示类的属性?

如何在.Net Framework C#中显示类的属性?,c#,.net,winforms,frameworks,components,C#,.net,Winforms,Frameworks,Components,我想用C#编写组件,并从System.Windows.Forms.Button继承该组件。我想从MyComponent中的另一个类获取属性 这是我的代码: public class ButtonX : Button { public class MyClass { public int MyProperty1 { get; set; } public int MyProperty2 { get; set; } public in

我想用C#编写组件,并从
System.Windows.Forms.Button
继承该组件。我想从MyComponent中的另一个类获取属性

这是我的代码:

public class ButtonX : Button
{


    public class MyClass
    {
        public int MyProperty1 { get; set; }
        public int MyProperty2 { get; set; }
        public int MyProperty3 { get; set; }
    }

    private MyClass myVar;

    public MyClass MyProperty
    {
        get { return myVar; }
        set { myVar = value; }
    }
}
在这张照片中:
红色=我的财产
蓝色=我想在我的财产中做什么

请参阅。用这个TypeConverter装饰类对象。还可以使用System.ComponentModel添加
。您只需要
public MyClass MyProperty{get;set;}=new MyClass()
可能的话,将
MyClass
定义移到自定义控件之外(不是组件)。