protected override void OnCreateControl() { base.OnCreateControl(); var vw = DefGridView = base.DefaultView as DevExpress.XtraGrid.Views.Grid.GridView; if (null != vw) { vw.OptionsView.ShowGroupPanel = false;// this.ShowGroupPanel; vw.OptionsView.ColumnAutoWidth = false; vw.OptionsView.ShowIndicator = this.ShowIndicator; vw.PopupMenuShowing -= vw_PopupMenuShowing; vw.PopupMenuShowing += vw_PopupMenuShowing; vw.CustomDrawRowIndicator -= vw_CustomDrawRowIndicator; vw.CustomDrawRowIndicator += vw_CustomDrawRowIndicator; vw.RowStyle -= vw_RowStyle; vw.RowStyle += vw_RowStyle; vw.OptionsView.ShowAutoFilterRow = true; vw.MouseDown += vw_MouseDown; vw.KeyDown += vw_KeyDown; vw.Appearance.SelectedRow.BackColor = Color.FromArgb(70, 80, 20, 20); vw.Appearance.FocusedRow.BackColor = Color.FromArgb(70, 80, 20, 20); vw.FocusedRowHandle = -1; DefGridView.BestFitColumns(); } }
//<gridControl1> private void InitGridColumns() { gridControl1.DataSource = data; //The line bellow creates columns on the fly. gridControl1.DefaultView.PopulateColumns(); gridView1.Columns["Payment Amount"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; gridView1.Columns["Payment Amount"].DisplayFormat.FormatString = "c"; gridView1.BestFitColumns(); }
private void DisplayData() { if (_data.DsData == null) { return; } this._bindingSource.DataSource = _data.DsData; this._bindingSource.CurrentChanged += new EventHandler(bindingSource_CurrentChanged); bindingSource_CurrentChanged(_bindingSource, new EventArgs()); this._bindingSource.DataMember = _data.DsData.Tables[0].TableName; this.gcMain.DataSource = _bindingSource; gcDetail.DataSource = _bindingSource; gcDetail.DataMember = this._data.DrTable["TableName"].ToString(); gvMain.BestFitColumns(); gvDetail.BestFitColumns(); }
public static void TemelGrid(DevExpress.XtraGrid.Views.Grid.GridView view) { view.GridControl.Resize += dgw_Resize; // best fit column view.BestFitColumns(); // gridlerin altındaki navigatörü gösteriyor. view.GridControl.UseEmbeddedNavigator = true; // son satıra focusluyor. view.RowLoaded += View_RowLoaded; // filtre verildiğinde alttaki filtrenin gözükmemesini sağlıyor. view.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.Never; //gruplama alanın kapatılması view.OptionsView.ShowGroupPanel = false; //satır renklendiriyor. view.CustomDrawCell += View_CustomDrawCell; //focuslanan satır özellikleri view.RowCellStyle += View_RowCellStyle; //filtre satırı view.OptionsView.ShowAutoFilterRow = false; //yeni satır view.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom; //Son kolonun otomatik geniletilmesi view.OptionsView.ColumnAutoWidth = false; view.OptionsDetail.EnableMasterViewMode = false; view.OptionsNavigation.EnterMoveNextColumn = false; view.OptionsNavigation.AutoFocusNewRow = true; view.OptionsNavigation.EnterMoveNextColumn = false; view.Appearance.FocusedRow.BackColor = Color.Transparent; view.Appearance.FocusedCell.BackColor = Color.Transparent; }
public void loadStockmain(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string tungay, string denngay, string kho, string tsbt) { view.Columns.Clear(); view.OptionsView.ColumnAutoWidth = true; DataTable dt = new DataTable(); DataTable temp = new DataTable(); dt.Columns.Add("ID", Type.GetType("System.String")); dt.Columns.Add("Mã kho", Type.GetType("System.String")); dt.Columns.Add("Tên kho", Type.GetType("System.String")); if (tsbt == "bkthbhtnvkd") { temp = gen.GetTable("select DISTINCT b.AccountingObjectID,AccountingObjectCode,b.AccountingObjectName from INOutward a, AccountingObject b where RefDate>='" + tungay + "' and RefDate <='" + denngay + "' and a.StockID = (select StockID from Stock where StockCode='" + kho + "') and EmployeeIDSA=b.AccountingObjectID order by AccountingObjectCode"); } for (int i = 0; i < temp.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = temp.Rows[i][0]; dr[1] = temp.Rows[i][1]; dr[2] = temp.Rows[i][2]; dt.Rows.Add(dr); } lvpq.DataSource = dt; view.OptionsBehavior.Editable = false; view.OptionsSelection.EnableAppearanceFocusedCell = false; view.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; view.Columns[0].Visible = false; view.BestFitColumns(); view.Columns["Mã kho"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; if (tsbt == "bkthbhtnvkd") { view.Columns["Mã kho"].Caption = "Mã nhân viên"; view.Columns["Tên kho"].Caption = "Tên nhân viên"; } }
protected override void OnCreateControl() { base.OnCreateControl(); var vw = DefGridView = base.DefaultView as DevExpress.XtraGrid.Views.Grid.GridView; if (null != vw) { vw.OptionsView.ShowGroupPanel = false;// this.ShowGroupPanel; vw.OptionsView.ColumnAutoWidth = false; vw.OptionsView.ShowIndicator = this.ShowIndicator; vw.PopupMenuShowing -= vw_PopupMenuShowing; vw.PopupMenuShowing += vw_PopupMenuShowing; vw.CustomDrawRowIndicator -= vw_CustomDrawRowIndicator; vw.CustomDrawRowIndicator += vw_CustomDrawRowIndicator; vw.RowStyle -= vw_RowStyle; vw.RowStyle += vw_RowStyle; vw.OptionsView.ShowAutoFilterRow = true; vw.MouseDown += vw_MouseDown; vw.KeyDown += vw_KeyDown; vw.Appearance.SelectedRow.BackColor = Color.FromArgb(70, 80, 20, 20); vw.Appearance.FocusedRow.BackColor = Color.FromArgb(70, 80, 20, 20); vw.FocusedRowHandle = -1; DefGridView.BestFitColumns(); } }
public void loadpkt(DevExpress.XtraGrid.GridControl lvpq, DevExpress.XtraGrid.Views.Grid.GridView view, string sql) { view.OptionsView.ColumnAutoWidth = true; DataTable dt = new DataTable(); DataTable temp = new DataTable(); view.Columns.Clear(); temp = gen.GetTable(sql); dt.Columns.Add("ID", Type.GetType("System.String")); dt.Columns.Add("Số chứng từ", Type.GetType("System.String")); dt.Columns.Add("Ngày chứng từ", Type.GetType("System.DateTime")); dt.Columns.Add("Ngày hạch toán", Type.GetType("System.DateTime")); dt.Columns.Add("Đối tượng", Type.GetType("System.String")); dt.Columns.Add("Người nộp", Type.GetType("System.String")); dt.Columns.Add("Lý do nộp", Type.GetType("System.String")); dt.Columns.Add("Số tiền", Type.GetType("System.Double")); dt.Columns.Add("Mã kho", Type.GetType("System.String")); dt.Columns.Add("Người thực hiện", Type.GetType("System.String")); for (int i = 0; i < temp.Rows.Count; i++) { DataRow dr = dt.NewRow(); dr[0] = temp.Rows[i][0].ToString(); dr[1] = temp.Rows[i][1].ToString(); dr[2] = temp.Rows[i][2].ToString(); dr[3] = temp.Rows[i][3].ToString(); dr[4] = temp.Rows[i][4].ToString(); dr[5] = temp.Rows[i][5].ToString(); dr[6] = temp.Rows[i][6].ToString(); dr[7] = temp.Rows[i][7].ToString(); dr[8] = temp.Rows[i][8].ToString(); dr[9] = temp.Rows[i][9].ToString(); dt.Rows.Add(dr); } lvpq.DataSource = dt; view.OptionsBehavior.Editable = false; view.OptionsSelection.EnableAppearanceFocusedCell = false; view.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus; view.Columns[0].Visible = false; view.Columns[5].Visible = false; view.Columns["Ngày chứng từ"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime; view.Columns["Ngày chứng từ"].DisplayFormat.FormatString = "dd/MM/yyyy"; view.Columns["Ngày chứng từ"].Width = 100; view.Columns["Ngày chứng từ"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; view.Columns["Ngày hạch toán"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime; view.Columns["Ngày hạch toán"].DisplayFormat.FormatString = "dd/MM/yyyy"; view.Columns["Ngày hạch toán"].Width = 100; view.Columns["Ngày hạch toán"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; view.Columns["Số tiền"].DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom; view.Columns["Số tiền"].DisplayFormat.FormatString = "{0:n0}"; view.OptionsView.ShowFooter = true; view.Columns["Số tiền"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum; view.Columns["Số tiền"].SummaryItem.DisplayFormat = "{0:n0}"; view.Columns[1].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Count; view.Columns[1].SummaryItem.DisplayFormat = "Số dòng: {0}"; view.Columns["Mã kho"].Width = 100; view.Columns["Mã kho"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; view.BestFitColumns(); }