What's the state of play with “Visual Inheritance”

后端 未结 6 1342
-上瘾入骨i
-上瘾入骨i 2021-01-05 02:27

We have an application that has to be flexible in how it displays it\'s main form to the user - depending on the user, the form should be slightly different, maybe an extra

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 02:53

    I am studying towards the (admittedly soon-to-be-obsoleted) MCAD, and part of the WinForms element was Visual Inheritence.

    I personally have had no major problems with it, however, there are considerations to take in to account.

    For me, the main problem has always initialization.. You need to remember that the designer cannot/does not instantiate forms in the same way it does at run time (similarly, it cannot do this with web dev, which is why care is needed with custom control rendering).

    Also, once a form is changed, a complete re-build of the project is required in order to propagate the changes to the form to the child forms that inherit from it.

    I personally have seen no evidence to suggest that it has been "shunned". AFAIK, its still good practice to exercise code re-use where possible. Visual inheritance provides that.

    May I suggest creating a new question with the actual problems you are having, with sample code? We can then look at it to see if we can get it working and explain why :)

提交回复
热议问题