How can “default” values in overridden WinForm controls be prevented?

前端 未结 3 1775
挽巷
挽巷 2021-01-14 11:45

I\'m trying to learn and grasp what and how C# does things. I\'m historically a Visual Foxpro (VFP) developer, and somewhat spoiled at the years of visual inheritance by cr

3条回答
  •  星月不相逢
    2021-01-14 12:09

    Try adding the ReadOnly attribute to the properties of your derived classes:

    [ReadOnly(true)]
    public override Font Font
    {
        get{ // Your Implementation Here }
        set{ // Don't really care,do you? }
    }
    

    The ReadOnlyAttribute should enforce the ReadOnly behavior at design time.

提交回复
热议问题