【发布时间】:2017-02-03 19:35:25
【问题描述】:
public class ThemeProperty
{
public Color FColor { get; set; } = Color.White;
public Color BColor { get; set; } = Color.Black;
}
[TypeConverter(typeof(ExpandableObjectConverter))]
public ThemeProperty Theme { get; set; } = new ThemeProperty();
// Use.
public void Test()
{
Theme.BColor = Color.Gray;
Theme.FColor = Color.Black;
Theme = true; /*I wanted to make the feature active or passive, but
I could not figure out how to define a property class for this line.*/
}
您好,我创建了一个名为 Theme 的可扩展属性。虽然我有两个功能,但如果我是主动或被动的,我想使用它们,如果我是主动的,我想使用它们。我可以在其中创建和控制一个功能,但它不灵活。我想像上面那样定义这个特性,但我不知道该怎么做。非常感谢您的帮助。
我想在红线上添加真假值。激活或停用功能。
【问题讨论】:
标签: c# syntax properties typeconverter