在MFC中,对话框的初始化采用的是重载虚函数OnInitialDialog的方法,在C#中可以直接在需要添加消息的类中添加消息处理函数。
在对话框载入时调用的函数如下:
1 private void Form1_Load(object sender, EventArgs e)2 {3 label1.Text = "C#";4 }
MSDN中说明如下:
Form.Load Event
.NET Framework 4.5
Occurs before a form is displayed for the first time.
Remarks
You can use this event to perform tasks such as allocating resources used by the form.