Run event when any Form loads

后端 未结 4 866
感情败类
感情败类 2020-12-12 02:13

I\'m trying to create a Popularity Contest for Forms in our primary front end. There are many items that are no longer used, but getting details on which are used and which

4条回答
  •  感情败类
    2020-12-12 03:01

    A not so expensive (maybe) solution can be this:

    Create a new class MyBaseForm, which inherits from System.Windows.Forms.Form, and handle its load event in the way you need.

    Now the hard part: modify all of the existing forms classes so they inherit from MyBaseForm and not from the default System.Windows.Forms.Form; and be sure you do the same for every future Form you will add to your solution.

    Not bullet proof at all, it can be easy to forget to modify the base class for a new form and/or to miss the modification for an existing form class

    But you can give it a try

提交回复
热议问题