private void AddLayoutControl() { int fieldCount = _data.DsStruct.Tables[0].Rows.Count; string path; string English = Config.GetValue("Language").ToString() == "1" ? "_E" : ""; if (Config.GetValue("DuongDanLayout") == null) { path = Application.StartupPath + "\\Layouts\\" + Config.GetValue("Package").ToString() + English + "\\" + _data.DrTable["TableName"].ToString() + ".xml"; } else { path = Config.GetValue("DuongDanLayout").ToString() + "\\" + Config.GetValue("Package").ToString() + English + "\\" + _data.DrTable["TableName"].ToString() + ".xml"; } if (fieldCount > 3) { lcMain = _frmDesigner.GenLayout3(ref gcMain, true); } else if (fieldCount > 2) { lcMain = _frmDesigner.GenLayout2(ref gcMain, true); } else { lcMain = _frmDesigner.GenLayout1(ref gcMain, true); } if (_data.DrTable["FileLayout" + English] == DBNull.Value) { if (System.IO.File.Exists(path)) { lcMain.RestoreLayoutFromXml(path); //UpLoad Layout to database System.IO.MemoryStream ms = new MemoryStream(); lcMain.SaveLayoutToStream(ms); _data.DrTable["FileLayout" + English] = ms.ToArray(); _data.updateLayoutFile(_data.DrTable); lcMain.ShowCustomization += lcMain_ShowCustomization; } } else { System.IO.MemoryStream ms = new System.IO.MemoryStream(_data.DrTable["FileLayout" + English] as byte[]); lcMain.RestoreLayoutFromStream(ms); lcMain.ShowCustomization += lcMain_ShowCustomization; } gcMain.DataSource = _bindingSource; gcMain.DataMember = this._data.DrTable["TableName"].ToString(); this.Controls.Add(lcMain); lcMain.BringToFront(); //if (this._frmDesigner.formAction == FormAction.View) //{ // TransparentPanel ptop = new TransparentPanel(); // ptop.BackColor = Color.FromArgb(100, 88, 44, 55); // ptop.Top = 0; ptop.Left = 0; // ptop.TabIndex = 0; // ptop.Width = Screen.PrimaryScreen.Bounds.Width; // ptop.Height = Screen.PrimaryScreen.Bounds.Height; // this.Controls.Add(ptop); ptop.BringToFront(); //} gvMain = gcMain.ViewCollection[0] as DevExpress.XtraGrid.Views.Grid.GridView; gvMain.OptionsView.ShowAutoFilterRow = false; gvMain.OptionsView.ShowGroupPanel = false; //gvMain.OptionsView.ShowFooter = false; //gvMain.BestFitColumns(); //Thêm phần bindingSource cho các Detail for (int i = 0; i < _data._drTableDt.Count; i++) { GridControl gc = _frmDesigner._gcDetail[i]; int position = _bindingSource.Position; gc.DataSource = _bindingSource; _bindingSource.Position = position; gc.DataMember = _data._drTableDt[i]["TableName"].ToString(); } //Thêm phần bindingSource cho các Detail }