摘要
程序设计中经常需要把参数从一个函数传递到另一个函数,或者获取某个函数的返回值。基于Winform的程序经常需要把参数从一个窗体传入到另一个窗体,或者某一窗体中内容变更时另一窗体相同内容随之改变,利用C#提供的类、对象属性、委托几种机制,提出通过使用构造函数对对象进行初始化、变更对象属性、借助委托等方法实现多个窗体间的参数传递和内容的同步更新显示。在对各种方法应用对比的同时,重点发掘了委托机制为实现窗体间内容的传递和同步更新所带来的优势。
The parameter transmission between forms and the synchronous update display realized with methods of the ob- ject initialization, variation of object properties and authorization implemented by constructing functions is put forward by the mechanisms of C# -provided classes, object properties and authorization. By comparison with various methods, the authoriza- tion mechanism is explored emphatically to realize the parameter transmission between forms and synchronous update.
出处
《现代电子技术》
2010年第14期64-66,共3页
Modern Electronics Technique