Why do we use UserControl?

后端 未结 4 2025
予麋鹿
予麋鹿 2020-12-19 18:53

ı have been serching this for a while but I couldn\'t come up with a conclusion. What is UserControl? For me we can do everything with creating new windows forms instead of

4条回答
  •  悲&欢浪女
    2020-12-19 19:25

    As the others have explained a UserControl groups 'real' Controls and the logic that makes them work together as one component.

    Imagine an application where the user can decide wether it runs in MDI mode or with separate windows or with tabbed pages. You can add the UCs of your application to any of these easily.

    Think of a MP3 player with various controls, buttons, labels and sliders and user drawn-gauges. If it's in a UC you can re-use it directly. If it is all on a window, how do you re-use it?

    So UCs are about flexibilty and re-using visual components.

提交回复
热议问题