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#展开式属性
我想在红线上添加真假值。激活或停用功能。
我试图用这种方式解释我还没有灵活。谢谢你的回复,我会组织这个问题。 – Emre