Automatic regenerate designer files

前端 未结 3 1263
轮回少年
轮回少年 2021-02-07 13:57

Recently I\'ve been making some improvements to a lot of the controls we use, for example give properties default values and making buttons private instead of protected. By maki

3条回答
  •  盖世英雄少女心
    2021-02-07 14:13

    The only way I found to do what you want, is to open the form designer, add a control, then save. This will regenerate the designer code. Next delete the newly added control, save again, and close.

    I usually add a button by double-clicking on the button in the toolbox. This puts the button at location 0,0.

    I did this a couple months ago with a project with about 100 form and user-controls. Instead of a macro that recursed over the project files, I recorded a temporary macro then ran the macro for each form/user-control and inspected the results.

    Do not confuse refactoring with reformatting. I often optimize and/or modify the designer code in large forms. For example, I will change the order controls are added to panels, and how panels are added to other panels. I would not blindly regenerate the designer code.

提交回复
热议问题