Example #1
0
            public FormStudent()
                : base()
            {
                this.gridStudent.Name = "gridStudent";
                this.gridStudent.Dock = DockStyle.Top;

                // 添加 DataGridView 到窗口
                this.Controls.AddRange(new Control[] { this.gridStudent });

                // 添加 Student 表格到 DataSet
                this.dsStudent.Tables.Add("Student");
                this.dsStudent.Tables["Student"].Columns.AddRange(
                    new DataColumn[]
                {
                    new DataColumn("Name"), new DataColumn("Age"), new DataColumn("ClassName")
                }
                    );

                // 创建 StudentCore
                StudentCore core = new StudentCore(this,
                                                   new TableSetting <PagerSetting>[]
                {
                    new TableSetting <PagerSetting>("Student", this.dsStudent.Tables["Student"], null, null, null)
                }
                                                   );

                // 绑定填充方法到窗口的 Load 事件
                core.BindDataEvent <EventArgs> (this, "Load", EventHandlerType.EventHandler, DataActionType.Fill, "Student");
            }