Can a Windows Forms control have a Design Time-only property?

前端 未结 1 1727
广开言路
广开言路 2021-01-14 07:02

I wish to allow the user of my control to choose the licensing method for the control. The choice comes from an enumeration, so they must choose one of the methods I have l

1条回答
  •  清酒与你
    2021-01-14 07:32

    You can give a control design-time behavior by creating a separate designer class for the control. Since the control itself can only exist as an instance of your runtime, you can't really have a property directly on it which is set only at design-time (where would it get stored?). However, designer classes are only invoked and used by the designer, so you can encapsulate non-runtime behavior there.

    0 讨论(0)
提交回复
热议问题