Add an event to all Forms in a Project

前端 未结 2 1150
天命终不由人
天命终不由人 2020-11-27 08:08

If I want to display the size of every Form in my Project in the Form\'s Title what will be the best approach?
I don\'t want to manually put a

2条回答
  •  悲哀的现实
    2020-11-27 08:44

    You can use Automation as @Jimi suggested.

    You can use My.Application.OpenForms to iterate throught all opened forms, but it will not help when new form is opened.

    You can create some ReportSizeForm class that inherits System.Forms.Form. And change inheritance of your forms from regular System.Windows.Forms.Form to your ReportSizeForm.

提交回复
热议问题