A call to InitializeComponent is automatically inserted in the constructor of your form/page. InitializeComponent is the auto-generated method that
- creates the various UI elements on your winform / XAML page
- initializes their properties with the values stored in the resource file
So anything related to UI arrangement/modifications should go after this call. When you do this in an override of Form.OnLoad , you're assured that the UI is ready to go (InitializeComponent has been called)... so I'd vote for sticking to OnLoad for UI.
Creating non-UI members, constructor would be the place I'd first look at.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…