C# 将方法调用插入InitializeComponent的某个位置
我试图扩展InitializeComponent方法的默认内容。 我想在那里添加几个方法调用 问题是-我需要将此调用定位在InitializeComponent方法的特定位置 例如,我希望在每个字段初始化后调用我的方法:C# 将方法调用插入InitializeComponent的某个位置,c#,winforms,codedom,C#,Winforms,Codedom,我试图扩展InitializeComponent方法的默认内容。 我想在那里添加几个方法调用 问题是-我需要将此调用定位在InitializeComponent方法的特定位置 例如,我希望在每个字段初始化后调用我的方法: this.ctrl1 = new UserControl(); MyMethod(); // <---- call of my method this.ctrl2 = new UserControl(); MyMethod(); // &l
this.ctrl1 = new UserControl();
MyMethod(); // <---- call of my method
this.ctrl2 = new UserControl();
MyMethod(); // <---- call of my method
this.SuspendLayout();
.................................
不幸的是,这正是我得到的结果
this.ctrl1 = new UserControl();
this.ctrl2 = new UserControl();
this.SuspendLayout();
MyMethod(); // <---- call of my method
.................................
this.ctrl1=newusercontrol();
this.ctrl2=新用户控件();
这个.SuspendLayout();
MyMethod()//
this.ctrl1 = new UserControl();
this.ctrl2 = new UserControl();
this.SuspendLayout();
MyMethod(); // <---- call of my method
.................................