public static StyleFormatCondition CreateStyleFormatCondition(FormatCondition conditionSetting) { StyleFormatCondition condition = new StyleFormatCondition(); var fontStyle = FontStyle.Regular; if (conditionSetting.Underline) { fontStyle |= FontStyle.Underline; } if (conditionSetting.Italic) { fontStyle |= FontStyle.Italic; } if (conditionSetting.Bold) { fontStyle |= FontStyle.Bold; } FontFamily fontFamily = new FontFamily(conditionSetting.FontName); System.Drawing.Font font = new Font(fontFamily, float.Parse(conditionSetting.Size), fontStyle); condition.Appearance.Font = font; condition.Condition = FormatConditionEnum.Expression; condition.Expression = conditionSetting.Conditions; condition.Appearance.BackColor = conditionSetting.Backcolor; condition.Appearance.ForeColor = conditionSetting.Forecolor; condition.Appearance.Options.UseFont = true; condition.Appearance.Options.UseForeColor = true; condition.Appearance.Options.UseBackColor = true; return(condition); }
/// <summary> /// 加入显示颜色等效果 /// </summary> private void ConditionsAdjustment() { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.Equal, gridView1.Columns["PATHWAY_STATUS"], null, 0); cn.ApplyToRow = true; cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Strikeout); //cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold); cn.Appearance.ForeColor = SystemColors.ButtonFace;//删除 gridView1.FormatConditions.Add(cn); cn = new StyleFormatCondition(FormatConditionEnum.Equal, gridView1.Columns["isInvalid"], null, 31); cn.ApplyToRow = true; cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Strikeout); cn.Appearance.ForeColor = SystemColors.ControlDarkDark;//作废 gridView1.FormatConditions.Add(cn); cn = new StyleFormatCondition(FormatConditionEnum.Equal, gridView1.Columns["isInvalid"], null, 21); cn.ApplyToRow = true; cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold); cn.Appearance.ForeColor = SystemColors.WindowText;//发布 gridView1.FormatConditions.Add(cn); cn = new StyleFormatCondition(FormatConditionEnum.Equal, gridView1.Columns["isInvalid"], null, 1); cn.ApplyToRow = true; cn.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Regular); cn.Appearance.ForeColor = Color.Blue;//未审核 gridView1.FormatConditions.Add(cn); //gridView1.BestFitColumns(); }
private void ConditionsColumnView(GridControl grd) { try { StyleFormatCondition[] cnArr = new StyleFormatCondition[2]; cnArr[0] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[0].Column = ((ColumnView)grd.MainView).Columns["PENDING_QTY"]; cnArr[0].Expression = @"[PENDING_QTY] > 0"; cnArr[0].Appearance.ForeColor = Color.Red; cnArr[0].Appearance.Options.UseBackColor = true; cnArr[0].Appearance.Options.UseForeColor = true; cnArr[0].ApplyToRow = false; cnArr[1] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[1].Column = ((ColumnView)grd.MainView).Columns["PENDING_BOX"]; cnArr[1].Expression = @"[PENDING_BOX] > 0"; cnArr[1].Appearance.ForeColor = Color.Red; cnArr[1].ApplyToRow = false; ((ColumnView)grd.MainView).FormatConditions.AddRange(cnArr); } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
public void Execute() { gvMain = (_data.FrmMain.Controls.Find("gridControlReport", true)[0] as GridControl).MainView as GridView; StyleFormatCondition h1 = new StyleFormatCondition(); gvMain.FormatConditions.Add(h1); h1.Column = gvMain.Columns["TinhTrangNP"]; h1.Condition = FormatConditionEnum.Equal; h1.Value1 = "Chưa đủ"; h1.Appearance.BackColor = Color.Yellow; h1.ApplyToRow = true; StyleFormatCondition h2 = new StyleFormatCondition(); gvMain.FormatConditions.Add(h2); h2.Column = gvMain.Columns["TinhTrangNP"]; h2.Condition = FormatConditionEnum.Equal; h2.Value1 = "Nhập đủ"; h2.Appearance.BackColor = Color.LightGreen; h2.ApplyToRow = true; StyleFormatCondition h = new StyleFormatCondition(); gvMain.FormatConditions.Add(h); h.Column = gvMain.Columns["DaSX"]; h.Condition = FormatConditionEnum.Equal; h.Value1 = true; h.Appearance.BackColor = Color.Gainsboro; h.ApplyToRow = true; }
void btnChon_Click(object sender, EventArgs e) { drCur = (_data.BsMain.Current as DataRowView).Row; if (!gvMain.Editable) { XtraMessageBox.Show("Vui lòng chọn chế độ thêm hoặc sửa phiếu", Config.GetValue("PackageName").ToString()); return; } //dùng report 1514 trong sysReport frmDS = FormFactory.FormFactory.Create(FormType.Report, "1514") as ReportPreview; //định dạng thêm cho grid của report gvDS = (frmDS.Controls.Find("gridControlReport", true)[0] as GridControl).MainView as GridView; StyleFormatCondition hh = new StyleFormatCondition(); gvDS.FormatConditions.Add(hh); hh.Column = gvDS.Columns["SL đã SX"]; hh.Condition = FormatConditionEnum.NotEqual; hh.Value1 = 0; hh.Appearance.BackColor = Color.LightCyan; hh.ApplyToRow = true; gvDS.DataSourceChanged += new EventHandler(gvDS_DataSourceChanged); FormatGrid(); //viết xử lý cho nút F4-Xử lý trong report SimpleButton btnXuLy = (frmDS.Controls.Find("btnXuLy", true)[0] as SimpleButton); btnXuLy.Text = "Chọn LSX"; btnXuLy.Click += new EventHandler(btnXuLy_Click); frmDS.WindowState = FormWindowState.Maximized; frmDS.ShowDialog(); }
public override void InitColumnMaster() { XtraGridSupportExt.TextLeftColumn(Cotloai_cv, "TEN_CV"); XtraGridSupportExt.TextLeftColumn(CotCTCCV_ID, "CTCCV_ID"); XtraGridSupportExt.TextLeftColumn(Cotmota, "MO_TA"); HelpGridColumn.CotPLTimeEdit(Cotthoigian, "THOI_GIAN_THUC_HIEN", PLConst.FORMAT_TIME_HH_MM); HelpGridColumn.CotPLTimeEdit(cotngaylamviec, "NGAY_LAM_VIEC", "ddd, dd/MM/yyyy"); HelpGridColumn.CotReadOnlyDate(CotNgaycapnhat, "NGAY_CAP_NHAT", PLConst.FORMAT_DATETIME_STRING); XtraGridSupportExt.TextLeftColumn(cotnhanvien, "NHANVIEN"); GridColumn column = new GridColumn(); //XtraGridSupportExt.CreateDuyetGridColumn(column); this.gridViewMaster.Columns.Add(column); this.cotnhanvien.Visible = false; this.cotngaylamviec.Visible = false; gridViewMaster.OptionsView.ShowGroupPanel = false; //Nếu ngày cập nhật > ngày làm việc 1 ngày -> Đỏ StyleFormatCondition condition = new StyleFormatCondition(); condition.Appearance.Options.UseForeColor = true; condition.Appearance.ForeColor = Color.Red; condition.Condition = FormatConditionEnum.Expression; condition.Expression = string.Format(@"(AddDays(AddTimeSpan([NGAY_LAM_VIEC],#{0}#),1) <= [NGAY_CAP_NHAT])", new TimeSpan(0, 0, 1)); condition.ApplyToRow = true; gridViewMaster.FormatConditions.Add(condition); //----------------------------- }
private void ConditionsColumnView(GridControl grd) { int index = 0; try { StyleFormatCondition[] cnArr = new StyleFormatCondition[2]; cnArr[index] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[index].Column = ((ColumnView)grd.MainView).Columns["PICKED_QTY"]; cnArr[index].Expression = @"[PICKED_QTY] > 0 AND [QTY] > [PICKED_QTY]"; cnArr[index].Appearance.ForeColor = Color.Red; cnArr[index].ApplyToRow = false; //next column Condition; index++; cnArr[index] = new StyleFormatCondition(FormatConditionEnum.Expression); cnArr[index].Column = ((ColumnView)grd.MainView).Columns["LOADED_QTY"]; cnArr[index].Expression = @"[PICKED_QTY] > 0 AND [PICKED_QTY] <> [LOADED_QTY]"; cnArr[index].Appearance.ForeColor = Color.Red; cnArr[index].ApplyToRow = false; ((ColumnView)grd.MainView).FormatConditions.AddRange(cnArr); } catch (Exception ex) { XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
protected void AddItemToListBox(StyleFormatCondition newItem) { ItemCondition newItemCondition = new ItemCondition(newItem); listBoxConditions.Items.Add(newItemCondition); listBoxConditions.SelectedItem = newItemCondition; }
/// <summary> /// 生成条件样式 /// </summary> /// <param name="info">XtraStyleConditionInfo</param> /// <param name="gridView">GridView</param> /// <returns></returns> public static StyleFormatCondition CreateFormatCondition(XtraStyleConditionInfo info, GridView gridView) { var col = gridView.Columns.ColumnByFieldName(info.ColumnName); if (col == null) { MB.Util.TraceEx.Write("Style Format condition 列名称的配置,在数据源中找不到对应的列,请检查。", MB.Util.APPMessageType.SysWarning); return null; } col.AppearanceCell.Options.UseTextOptions = true; DevExpress.XtraGrid.StyleFormatCondition formatCondition = new StyleFormatCondition(info.Condition, col, info.StyleName, info.Value, info.Value2, info.ApplyToRow); if (!string.IsNullOrEmpty(info.Expression)) { formatCondition.Condition = FormatConditionEnum.Expression; formatCondition.Expression = info.Expression; } formatCondition.Tag = info.Name; formatCondition.Appearance.Font = info.ForeFont; formatCondition.Appearance.ForeColor = info.ForeColor; formatCondition.Appearance.BackColor = info.BackColor; return formatCondition; }
/// <summary> /// Define uma coluna CheckBox com padrão de seleção de linhas /// </summary> /// <param name="pView">View da Grid</param> /// <param name="pColumnName">Nome da coluna</param> /// <param name="pColumnCaption">Título da coluna</param> public static void SetSelectColumn(this GridView pView, string pColumnName, string pColumnCaption) { pView.Appearance.Reset(); var myCol = new GridColumn(); myCol.FieldName = pColumnName; myCol.Name = pColumnName; myCol.Caption = pColumnCaption; myCol.UnboundType = DevExpress.Data.UnboundColumnType.Boolean; pView.Columns.Add(myCol); myCol.Visible = true; var myCondition = new StyleFormatCondition( FormatConditionEnum.Equal, myCol, true, true, true, true); myCondition.Appearance.BackColor = Color.FromArgb(240, 204, 77); myCondition.Appearance.ForeColor = Color.Black; pView.FormatConditions.Add(myCondition); }
/// <summary> /// Dinh dang field voi dieu kien kem theo /// </summary> /// <param name="grid"></param> /// <param name="fieldName"></param> /// <param name="condition"></param> /// <param name="color"></param> /// <param name="value"></param> public static void ConditionsAdjustment(GridView grid, string fieldName, FormatConditionEnum condition, Color color, object value) { StyleFormatCondition cn = new StyleFormatCondition(condition, grid.Columns[fieldName], null, value); cn.Appearance.BackColor = color; grid.FormatConditions.Add(cn); }
/// <summary> /// 把汇总条件绑定到网格上,让用户能自由操作 /// 每次动态聚组窗口加载是调用 /// </summary> public void BindDynamicGroupColumnsToGrid() { //用到的全局变量 DynamicGroupCfgInfo dyConfigInfo = _DynamicCfgInfo; GridControlEx grid = _GirdControl; IClientRuleQueryBase clientRuleObject = _ClientRuleObject; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(DynamicGroupUIHelper.DYNAMIC_CONDITION_UI_XML_CONTENT); var cols = _UIXmlHelper.GetColumnPropertys(xmlDoc); var colEdits = _UIXmlHelper.GetColumnEdits(cols, xmlDoc); var gridViewLayoutInfo = _UIXmlHelper.GetGridColumnLayoutInfo(xmlDoc, string.Empty); #region 准备数据源 //先从缓存的地方恢复设置,如果没有 List <DynamicGroupUIColumns> columns = RestoreDynamicGroupSetting(); if (columns == null) { //从配置重初始化 columns = GetDynamicGroupColumnsFromConfig(); } BindingList <DynamicGroupUIColumns> bindingList = new BindingList <DynamicGroupUIColumns>(columns); bindingList.AllowNew = false; bindingList.AllowRemove = false; #endregion var detailBindingParams = new MB.XWinLib.GridDataBindingParam(grid, bindingList); MB.XWinLib.XtraGrid.XtraGridEditHelper gridEditHelper = MB.XWinLib.XtraGrid.XtraGridEditHelper.Instance; gridEditHelper.CreateEditXtraGrid(detailBindingParams, cols, colEdits, gridViewLayoutInfo); gridEditHelper.AppendEditSelectedColumn(grid, "选择", DynamicGroupUIHelper.DYMANIC_GROUP_COL_SELECTED); GridView mainView = grid.MainView as GridView; if (mainView != null) { mainView.OptionsView.NewItemRowPosition = NewItemRowPosition.None; mainView.OptionsSelection.MultiSelect = true; mainView.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False; mainView.OptionsBehavior.AllowDeleteRows = DevExpress.Utils.DefaultBoolean.False; } #region 对聚合的字段加载样式,前景色蓝色 var aggTypeCol = mainView.Columns.ColumnByFieldName(DynamicGroupUIHelper.DYMANIC_GROUP_AGG_TYPE); if (aggTypeCol != null) { StyleFormatCondition formatCondition = new StyleFormatCondition( DevExpress.XtraGrid.FormatConditionEnum.NotEqual, aggTypeCol, "列类型", string.Empty, null, true); formatCondition.Appearance.ForeColor = Color.Blue; if (formatCondition != null) { mainView.FormatConditions.Add(formatCondition); } } #endregion }
private void CreateNewFormatCondition() { StyleFormatCondition item = new StyleFormatCondition(); item.Column = SourceGridColumn; SourceGridView.FormatConditions.Add(item); AddItemToListBox(item); }
private void SetGridControlColor() { StyleFormatCondition styleFormatCondition = new StyleFormatCondition(FormatConditionEnum.Equal, this.gridViewTemplatePerson.Columns["Used"], null, "否"); styleFormatCondition.Appearance.BackColor = Color.Red; styleFormatCondition.Appearance.ForeColor = Color.White; this.gridViewTemplatePerson.FormatConditions.Add(styleFormatCondition); }
private void ConditionsAdjustment() { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.LessOrEqual, gridView1.Columns["Balance_T空闲信道"], null, 0); cn.Appearance.BackColor = Color.Red; cn.Appearance.ForeColor = Color.White; gridView1.FormatConditions.Add(cn); }
private void ConditionsAdjustment_equal(string col, int thr) { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.Equal, gridView2.Columns[col], null, thr); cn.Appearance.BackColor = Color.Red; cn.Appearance.ForeColor = Color.White; gridView2.FormatConditions.Add(cn); }
private void PreviewData() { StyleFormatCondition styleFormatCondition = new StyleFormatCondition(FormatConditionEnum.Equal, this.gbList.Columns["IsEdit"], null, true); styleFormatCondition.Appearance.BackColor = Color.White; this.gbList.FormatConditions.Add(styleFormatCondition); styleFormatCondition = new StyleFormatCondition(FormatConditionEnum.Equal, this.gbList.Columns["IsEdit"], null, false); styleFormatCondition.Appearance.BackColor = Color.WhiteSmoke; this.gbList.FormatConditions.Add(styleFormatCondition); }
public void CopyToStyleFormats(StyleFormatConditionCollection styles) { styles.Clear(); foreach (SerializableFormatCondition serializableFormat in this) { StyleFormatCondition style = new StyleFormatCondition(); styles.Add(style); serializableFormat.CopyToStyleFormat(style); } }
private static StyleFormatCondition CreateStyleFormatCondition(FilterCondition conditionSetting) { StyleFormatCondition condition = new StyleFormatCondition(); condition.Condition = FormatConditionEnum.Expression; condition.Expression = conditionSetting.Conditions; condition.Appearance.Options.UseFont = true; condition.Appearance.Options.UseForeColor = true; condition.Appearance.Options.UseBackColor = true; return(condition); }
private void ConditionsAdjustment_thr(string col, int min_thr, int max_thr) { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.Less, gridView2.Columns[col], null, min_thr); cn.Appearance.BackColor = Color.Red; cn.Appearance.ForeColor = Color.White; gridView2.FormatConditions.Add(cn); cn = new StyleFormatCondition(FormatConditionEnum.Greater, gridView2.Columns[col], null, max_thr); cn.Appearance.BackColor = Color.Green; gridView2.FormatConditions.Add(cn); }
private void Form1_Load(object sender, EventArgs e) { StyleFormatCondition condition1 = new StyleFormatCondition(); condition1.Appearance.BackColor = Color.Navy; condition1.Appearance.Options.UseBackColor = true; condition1.Condition = FormatConditionEnum.Expression; condition1.ApplyToRow = false; condition1.Expression = "[Value1] > 2"; condition1.Column = gridColumn3; myGridView1.FormatConditions.Add(condition1); }
/// <summary> /// 添加对应的数据列 /// </summary> private void InitialFormControls() { GridViewHelper.SetGridView(grvDataList); //grvDataList.IndicatorWidth = 60; grvDataList.OptionsView.ShowIndicator = false; DataTable dataTable; DataColumn dc; GridColumn gridColumn; dataTable = new DataTable(BASE_ATTRIBUTE_CATEGORY_FIELDS.DATABASE_TABLE_NAME); dc = dataTable.Columns.Add(COMMON_FIELDS.FIELD_COMMON_CHECKED, typeof(bool)); dc.Caption = "选择"; dc.ReadOnly = false; dc = dataTable.Columns.Add(BASE_ATTRIBUTE_CATEGORY_FIELDS.FIELDS_CATEGORY_KEY); dc.Caption = "基础数据表主键"; dc.ReadOnly = true; dc = dataTable.Columns.Add(BASE_ATTRIBUTE_CATEGORY_FIELDS.FIELDS_CATEGORY_NAME); dc.Caption = "基础数据表类型"; dc.ReadOnly = true; ControlUtils.InitialGridView(this.grvDataList, dataTable); this.grvDataList.Columns[COMMON_FIELDS.FIELD_COMMON_CHECKED].Width = 35; this.grvDataList.Columns[COMMON_FIELDS.FIELD_COMMON_CHECKED].OptionsColumn.AllowSort = DevExpress.Utils.DefaultBoolean.False; this.grvDataList.Columns[BASE_ATTRIBUTE_CATEGORY_FIELDS.FIELDS_CATEGORY_KEY].Visible = false; gridColumn = this.grvDataList.Columns.ColumnByFieldName(COMMON_FIELDS.FIELD_COMMON_CHECKED); if (gridColumn != null) { RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit(); checkEdit.QueryCheckStateByValue += new QueryCheckStateByValueEventHandler(ControlUtils.QueryCheckStateByValue); checkEdit.CheckedChanged += new EventHandler(checkEdit_CheckedChanged); gridColumn.ColumnEdit = checkEdit; StyleFormatCondition checkCondition = new StyleFormatCondition(); checkCondition.Appearance.BackColor = Color.Green; checkCondition.Appearance.Options.UseBackColor = true; checkCondition.ApplyToRow = true; checkCondition.Condition = DevExpress.XtraGrid.FormatConditionEnum.Equal; checkCondition.Value1 = true; checkCondition.Column = gridColumn; this.grvDataList.FormatConditions.Add(checkCondition); } }
private void AbrirEditor(StyleFormatCondition styleFormatCondition) { using (ExpressionEditorForm expressionEditorForm = new ConditionExpressionEditorForm(styleFormatCondition, null)) { expressionEditorForm.Text = "Editor de expressão"; expressionEditorForm.StartPosition = FormStartPosition.CenterScreen; //form.Icon = BitmapFrame.Create(new Uri("pack://application:,,,/Icone_Globus_2008.ico", UriKind.RelativeOrAbsolute)); if (expressionEditorForm.ShowDialog(this) == DialogResult.OK) { styleFormatCondition.Expression = expressionEditorForm.Expression; } } }
public void FormatRows() { // --- style mri StyleFormatCondition style = new StyleFormatCondition(); style.Column = gridview.Columns["Flag_mri"]; style.ApplyToRow = true; style.Value1 = 1; style.Condition = FormatConditionEnum.Equal; style.Appearance.BackColor = Color.Orange; style.Appearance.Options.UseBackColor = true; gridview.FormatConditions.Add(style); }
private void FrmStrList_Load(object sender, EventArgs e) { this.Text = "Danh s\x00e1ch giao dịch kho h\x00e0ng"; base.Tag = "tblTransaction"; this.method_0(); this.method_1(); StyleFormatCondition condition = null; condition = new StyleFormatCondition(FormatConditionEnum.Equal, this.gridView1.Columns["status"], null, "False"); condition.Appearance.BackColor = Color.Red; this.gridView1.FormatConditions.Add(condition); condition.ApplyToRow = true; this.Lbl_duaration.Text = "Từ ng\x00e0y " + string.Format("{0:dd/MM/yyyy}", Class7.dateTimeFrom) + " đến ng\x00e0y " + string.Format("{0:dd/MM/yyyy}", Class7.dateTimeTo); }
private void ConditionsAdjustment() { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.Less, gridView1.Columns["订货单价"], null, gridView1.Columns["数量"]); cn.Appearance.BackColor = Color.Yellow; gridView1.FormatConditions.Add(cn); cn = new StyleFormatCondition(FormatConditionEnum.Greater, gridView1.Columns["订货单价"], null, gridView1.Columns["数量"]); cn.Appearance.BackColor = Color.Red; cn.Appearance.ForeColor = Color.White; gridView1.FormatConditions.Add(cn); //.. gridView1.BestFitColumns(); }
private void btnNew_Click(object sender, EventArgs e) { StyleFormatCondition condition = new StyleFormatCondition(); condition.Condition = FormatConditionEnum.Expression; TargetGrid.View.FormatConditions.Add(condition); ShowEditor(condition); if (string.IsNullOrEmpty(condition.Expression)) { TargetGrid.View.FormatConditions.Remove(condition); } Grid.RefreshData(); Grid.View.MoveLastVisible(); }
public void Init(ItemCondition item) { if (item != null) { currentFormatCondition = item.Condition; CreateValues(item.Condition.Column.ColumnType); } else { currentFormatCondition = null; } RefreshEditorsValues(item); UpdateEditors(item); }
private void SetGridControlConsultationColor() { StyleFormatCondition cn1; cn1 = new StyleFormatCondition(FormatConditionEnum.Equal, gridViewCardList.Columns[m_App.PublicMethod.ConvertProperty("REPORTTYPENAME")], null, "订正报告"); cn1.Appearance.BackColor = Color.LightGreen; cn1.Appearance.ForeColor = Color.DarkGreen; gridViewCardList.FormatConditions.Add(cn1); StyleFormatCondition cn2; cn2 = new StyleFormatCondition(FormatConditionEnum.Equal, gridViewCardList.Columns[m_App.PublicMethod.ConvertProperty("REPORTTYPENAME")], null, "初步报告"); cn2.Appearance.BackColor = Color.LightBlue; cn2.Appearance.ForeColor = Color.DarkBlue; gridViewCardList.FormatConditions.Add(cn2); }
//private void GvMain_RowStyle(object sender, RowStyleEventArgs e) //{ // GridView View = sender as GridView; // if (e.RowHandle >= 0) // { // bool duyet = (bool) View.GetRowCellValue(e.RowHandle, View.Columns["Duyet"]); // if (duyet) // { // //green // e.Appearance.BackColor = Color.LightGreen; // e.Appearance.BackColor2 = Color.LightGreen; // } // } //} void FrmMain_Load(object sender, EventArgs e) { if ((_data.BsMain.DataSource as DataSet).Tables[0].Columns.Contains("Duyet")) { //dung class StyleFormatCondition cho Duyet StyleFormatCondition d = new StyleFormatCondition(); gvMain.FormatConditions.Add(d); //thiet lap dieu kien d.Column = gvMain.Columns["Duyet"]; d.Condition = FormatConditionEnum.Equal; d.Value1 = true; //thiet lap dinh dang d.Appearance.BackColor = Color.LightGreen; d.ApplyToRow = true; } }
private void frmUretimEmri_Load(object sender, EventArgs e) { try { using (daUretim.SelectCommand = new SqlCommand(@"SELECT dbo.UretimEmri.UretimEmriID, dbo.UretimEmri.PartiNo, dbo.UretimEmri.UretimTarihi, dbo.UretimEmri.OzelKod1, dbo.UretimEmri.OzelKod2, dbo.UretimEmri.CariID, dbo.UretimEmri.SarfAmbarID, dbo.UretimEmri.UretimdenGirisAmbarID, dbo.UretimEmri.ReceteMasterID, dbo.UretimEmri.UretimMiktari, dbo.UretimEmri.BaslangicTarihi, dbo.UretimEmri.BitisTarihi, dbo.UretimEmri.TeslimTarihi, dbo.UretimEmri.UretimAciklama, dbo.UretimEmri.Durum, CASE WHEN Durum = 0 THEN 'Kaydedildi' ELSE 'Üretildi' END AS UretimDurum, dbo.UretimEmri.KaydedenID, dbo.UretimEmri.KayitTarihi, dbo.UretimEmri.GuncelleyenID, dbo.UretimEmri.GuncellemeTarihi, SarfAmbar.DepoAdi AS SarfAmbar, UretimAmbar.DepoAdi AS UretimdenGiris FROM dbo.UretimEmri LEFT OUTER JOIN dbo.Depo AS UretimAmbar ON dbo.UretimEmri.UretimdenGirisAmbarID = UretimAmbar.DepoID LEFT OUTER JOIN dbo.Depo AS SarfAmbar ON dbo.UretimEmri.SarfAmbarID = SarfAmbar.DepoID ORDER BY dbo.UretimEmri.UretimEmriID DESC", SqlConnections.GetBaglanti())) { dt.Clear(); daUretim.Fill(dt); gcUretimEmri.DataSource = dt; } GridArayuzIslemleri(enGridArayuzIslemleri.Get); #region GRİD SATIR RENKLERİ AYARLANIYOR StyleFormatCondition cTamamlandi = new StyleFormatCondition(FormatConditionEnum.Equal, gvUretimEmri.Columns["UretimDurum"], "cTamamlandi", "Üretildi"); //cTamamlandi.Appearance.BackColor = Color.LightGreen; cTamamlandi.Appearance.ForeColor = System.Drawing.Color.Green; //Color.FromName(Sirada); //cTamamlandi.Appearance.Options.UseBackColor = true; cTamamlandi.Appearance.Options.UseForeColor = true; cTamamlandi.ApplyToRow = true; gvUretimEmri.FormatConditions.Add(cTamamlandi); //***************** StyleFormatCondition cKaydedildi = new StyleFormatCondition(FormatConditionEnum.Equal, gvUretimEmri.Columns["UretimDurum"], "cKaydedildi", "Kaydedildi"); //cTamamlandi.Appearance.BackColor = Color.LightGreen; cKaydedildi.Appearance.ForeColor = System.Drawing.Color.Red; //Color.FromName(Sirada); //cTamamlandi.Appearance.Options.UseBackColor = true; cKaydedildi.Appearance.Options.UseForeColor = true; cKaydedildi.ApplyToRow = true; gvUretimEmri.FormatConditions.Add(cKaydedildi); #endregion } catch (Exception hata) { frmHataBildir frmHataBildir = new frmHataBildir(hata.Message, hata.StackTrace); frmHataBildir.ShowDialog(); } }
public UCTreeListDataPermission() { InitializeComponent(); HelpTreeList.CotCheckEdit(ColIsCreate_Bit, "ISCREATE_BIT"); HelpTreeList.CotCheckEdit(ColIsRead_Bit, "ISREAD_BIT"); HelpTreeList.CotCheckEdit(ColIsUpdate_Bit, "ISUPDATE_BIT"); HelpTreeList.CotCheckEdit(ColIsDelete_Bit, "ISDELETE_BIT"); HelpTreeList.CotCheckEdit(ColFull_Bit, "ISFULL_BIT"); HelpTreeList.CotCheckEdit(ColISUseCreate, "USE_CREATE"); HelpTreeList.CotTextLeft(ColName, "NAME"); this.TreePermission.ParentFieldName = "PARENT_ID"; this.TreePermission.KeyFieldName = "RESOURCE_ID"; StyleFormatCondition style = new StyleFormatCondition(); style.Column = ColIsCreate_Bit; style.Expression = "[USE_CREATE]=='N'"; style.Condition = DevExpress.XtraGrid.FormatConditionEnum.Expression; style.Appearance.BackColor = Color.DarkGray; style.Appearance.Options.UseBackColor = true; TreePermission.FormatConditions.Add(style); }
public override void InitColumDetail() { //Format dòng không phải là thời gian làm việc. StyleFormatCondition conditionNotWork = new StyleFormatCondition(FormatConditionEnum.NotEqual, CotLoai, null,((Int32)TimeInOutType.GhiThoiGian).ToString()); conditionNotWork.Appearance.ForeColor = Color.Red; conditionNotWork.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular); conditionNotWork.Column = CotLoai; conditionNotWork.ApplyToRow = true; //Format cột thời gian bắt đầu /* Nếu giờ bắt đầu > thời gian bắt đầu sáng 1 giây * hoặc chỉ làm 1 buối trong ngày và ngày đó không phải là thứ 7 ==> tô màu * GetDayOfWeek([NGAY_LAM_VIEC] != '6') ==> không phải thứ 7 */ StyleFormatCondition conditionGBD = new StyleFormatCondition(); conditionGBD.Appearance.Options.UseForeColor = true; conditionGBD.Appearance.ForeColor = Color.Red; conditionGBD.Condition = FormatConditionEnum.Expression; // conditionGBD.Expression = string.Format(@" // (GetTimeOfDay(AddTimeSpan(Today(),[GIO_BAT_DAU])) >= GetTimeOfDay(AddTimeSpan(Today(), #{0}#)) // OR (GetTimeOfDay(AddTimeSpan(Today(),[THOI_GIAN_LAM_VIEC])) <= GetTimeOfDay(AddTimeSpan(Today(), #{1}#)) // AND GetDayOfWeek([NGAY_LAM_VIEC]) != '6')) AND [THOI_GIAN_LAM_VIEC] != ?" // , AppGetSysParam.GetGIO_BAT_DAU_SANG.Add(new TimeSpan(0, 0, 0, 1)),AppGetSysParam.GetGIO_KET_THUC_SANG - AppGetSysParam.GetGIO_BAT_DAU_SANG); conditionGBD.Expression = string.Format(@" (GetTimeOfDay(AddTimeSpan(Today(),[GIO_BAT_DAU])) >= GetTimeOfDay(AddTimeSpan(Today(), #{0}#)))"// AND [THOI_GIAN_LAM_VIEC] != ?" , AppGetSysParam.GetGIO_BAT_DAU_SANG.Add(new TimeSpan(0, 0, 0, 1))); conditionGBD.Column = Cot_GioBatDau; //Format cột thời gian kết thúc StyleFormatCondition conditionGKT = new StyleFormatCondition(); conditionGKT.Appearance.Options.UseForeColor = true; conditionGKT.Appearance.ForeColor = Color.Red; conditionGKT.Condition = FormatConditionEnum.Expression; /* Nếu giờ kết thúc trong khoảng từ lúc bắt đầu sáng cho tới trước khi kết * hoặc chỉ làm 1 buối trong ngày và ngày đó không phải là thứ 7 ==> tô màu * GetDayOfWeek([NGAY_LAM_VIEC] != '6') ==> không phải thứ 7 */ conditionGKT.Expression = string.Format(@" (GetTimeOfDay(AddTimeSpan(Today(),[GIO_KET_THUC])) > GetTimeOfDay(AddTimeSpan(Today(), #{0}#)) AND (GetTimeOfDay(AddTimeSpan(Today(),[GIO_KET_THUC])) < GetTimeOfDay(AddTimeSpan(Today(), #{1}#)) AND GetDayOfWeek([NGAY_LAM_VIEC]) != '6'))" , AppGetSysParam.GetGIO_BAT_DAU_SANG, AppGetSysParam.GetGIO_KET_THUC_CHIEU); conditionGKT.Column = Cot_GioKetThuc; /* Nếu giờ kết thúc trong > giờ kết thúc buổi trưa và là ngày thứ 7 ==> tô lại màu đen * vì thứ 7 chỉ làm buổi sáng * GetDayOfWeek([NGAY_LAM_VIEC] == '6') ==> thứ 7 */ // StyleFormatCondition conditionNLV = new StyleFormatCondition(); // conditionNLV.Appearance.ForeColor = Color.Black; // conditionNLV.Appearance.Options.UseForeColor = true; // conditionNLV.Condition = FormatConditionEnum.Expression; // conditionNLV.Expression = string.Format(@" // GetTimeOfDay(AddTimeSpan(Today(),[GIO_KET_THUC])) > GetTimeOfDay(AddTimeSpan(Today(), #{0}#)) // AND GetDayOfWeek([NGAY_LAM_VIEC]) == '6'" // , AppGetSysParam.GetGIO_KET_THUC_SANG); // conditionNLV.Column = Cot_GioKetThuc; // gridViewMaster.FormatConditions.AddRange(new StyleFormatCondition[] { conditionNotWork, conditionGBD, conditionGKT }); }
/// <summary> /// Định dạng in đậm, màu dòng cấp cha /// </summary> void FormatRows() { var sfc = new StyleFormatCondition(DevExpress.XtraGrid.FormatConditionEnum.Equal, trlMain.Columns["Format"], null, true, true, true); sfc.Appearance.BackColor = Color.Orange; sfc.Appearance.BackColor2 = Color.Yellow; sfc.Appearance.GradientMode = LinearGradientMode.BackwardDiagonal; var f = new Font(Font, FontStyle.Bold); sfc.Appearance.Font = f; sfc.Appearance.ForeColor = Color.Blue; trlMain.FormatConditions.Add(sfc); }
private void FormESSUBJ_Load(object sender, EventArgs e) { this.InitDevGridCustomButtons(); this.fgDevGridGroupInfo.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(GroupInfoEmbeddedNavigator_ButtonClick); this.fgDevGridUserInfo.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(UserInfoEmbeddedNavigator_ButtonClick); this.fgDevGridDeptInfo.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(DeptInfoEmbeddedNavigator_ButtonClick); //查询用户管辖范围内的部门信息 getUserDept(); //获取当前系统中所有的APPNAME信息 RepositoryItemComboBox repstryItemGroupComboBoxApp = new RepositoryItemComboBox(); EI.EIInfo inBlockAPP = new EI.EIInfo(); EI.EIInfo outBlockAPP = new EI.EIInfo(); inBlockAPP.SetColName(1, "ename"); inBlockAPP.SetColVal(1, "ename", ""); outBlockAPP = EI.EITuxedo.CallService("epesappinfo", inBlockAPP); if (outBlockAPP.sys_info.flag != 0) { MessageBox.Show(string.Format(EP.EPES.EPESC0000061/*获取APPNAME信息错误:{0}*/, outBlockAPP.sys_info.msg), EP.EPES.EPESC0000024, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } String stemp = ""; //fgComboBoxApp.Items.Clear(); for (int i = 0; i < outBlockAPP.blk_info[0].Row; i++) { stemp = outBlockAPP.GetColVal(1, i + 1, "ename") + ": " + outBlockAPP.GetColVal(1, i + 1, "cname"); //fgComboBoxApp.Items.Add(stemp); fgDevComboBoxEditApp.Properties.Items.Add(stemp); repstryItemGroupComboBoxApp.Items.Add(outBlockAPP.GetColVal(1, i + 1, "ename")); } gridViewGroupInfo.Columns["APPNAME"].ColumnEdit = repstryItemGroupComboBoxApp; //群组信息的子系统列只允许从下拉列表中选择 repstryItemGroupComboBoxApp.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; if (outBlockAPP.blk_info[0].Row > 0) { //fgComboBoxApp.SelectedIndex = 0; fgDevComboBoxEditApp.SelectedIndex = 0; } //获取帐套信息 InitComboBoxCompany(); //用户信息的是否有效列只允许从下拉列表中选择 repstryItemComboBoxUserIsEnable.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; //用户信息的部门号列只允许从下拉列表中选择 repstryItemComboBoxUserDeptName.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; //设置checkbox选中行样式 DevExpress.Skins.Skin currentSkin; currentSkin = DevExpress.Skins.CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Dfgault); Color textColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.WindowText); Color highlightTextColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.HighligthText); Color selectColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.Highlight); StyleFormatCondition cnGroup; cnGroup = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridGroupInfo.SelectionColumn, null, false); cnGroup.ApplyToRow = true; cnGroup.Appearance.BackColor = Color.Empty; cnGroup.Appearance.ForeColor = textColor; gridViewGroupInfo.FormatConditions.Add(cnGroup); cnGroup = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridGroupInfo.SelectionColumn, null, true); cnGroup.ApplyToRow = true; cnGroup.Appearance.BackColor = selectColor; cnGroup.Appearance.ForeColor = highlightTextColor; gridViewGroupInfo.FormatConditions.Add(cnGroup); StyleFormatCondition cnUser; cnUser = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridUserInfo.SelectionColumn, null, false); cnUser.ApplyToRow = true; cnUser.Appearance.BackColor = Color.Empty; cnUser.Appearance.ForeColor = textColor; gridViewUserInfo.FormatConditions.Add(cnUser); cnUser = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridUserInfo.SelectionColumn, null, true); cnUser.ApplyToRow = true; cnUser.Appearance.BackColor = selectColor; cnUser.Appearance.ForeColor = highlightTextColor; gridViewUserInfo.FormatConditions.Add(cnUser); StyleFormatCondition cnDept; cnDept = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridDeptInfo.SelectionColumn, null, false); cnDept.ApplyToRow = true; cnDept.Appearance.BackColor = Color.Empty; cnDept.Appearance.ForeColor = textColor; gridViewDeptInfo.FormatConditions.Add(cnDept); cnDept = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridDeptInfo.SelectionColumn, null, true); cnDept.ApplyToRow = true; cnDept.Appearance.BackColor = selectColor; cnDept.Appearance.ForeColor = highlightTextColor; gridViewDeptInfo.FormatConditions.Add(cnDept); fgDevGridGroupInfo.ShowAddRowButton = false; fgDevGridGroupInfo.ShowAddCopyRowButton = false; fgDevGridGroupInfo.ShowDeleteRowButton = false; fgDevGridGroupInfo.SetAllColumnEditable(false); fgDevGridUserInfo.ShowAddRowButton = false; fgDevGridUserInfo.ShowAddCopyRowButton = false; fgDevGridUserInfo.ShowDeleteRowButton = false; fgDevGridUserInfo.SetAllColumnEditable(false); fgDevGridDeptInfo.ShowAddRowButton = false; fgDevGridDeptInfo.ShowAddCopyRowButton = false; fgDevGridDeptInfo.ShowDeleteRowButton = false; fgDevGridDeptInfo.SetAllColumnEditable(false); fgDevGridUserInfo.SelectionColumn.OptionsColumn.AllowEdit = true; }
public override void InitColumDetail() { ////Format 1 dòng lưới StyleFormatCondition cn = new StyleFormatCondition(FormatConditionEnum.NotEqual, CotLoai, null, "1"); cn.Appearance.ForeColor = Color.Red; cn.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold); cn.Column = CotLoai; cn.ApplyToRow = true; gridViewMaster.FormatConditions.Add(cn); }
public override void InitColumnMaster() { HelpGridColumn.CotTextLeft(colTen_DA, "NAME"); HelpGridColumn.CotTextLeft(colLoaiDA, "TEN_DA"); HelpGridColumn.CotTextLeft(colTenKhachHang, "TEN_KHACH_HANG"); HelpGridColumn.CotTextLeft(colNguoi_QL, "TEN_NGUOI_QL"); HelpGridColumn.CotTextLeft(colT_trang, "TEN_TT"); HelpGridColumn.CotTextLeft(colMuc_UT, "TEN_MUC"); XtraGridSupportExt.DateTimeGridColumn(colNgay_BD_DA, "NGAY_BAT_DAU"); XtraGridSupportExt.DateTimeGridColumn(colNgayKT_DA_DuKien, "NGAY_KET_THUC"); XtraGridSupportExt.DateTimeGridColumn(cotNgayKetThucTT, "NGAY_KET_THUC_THUC_TE"); HelpGridColumn.CotTextCenter(codT_do_DA, "TIEN_DO_PT"); ////////////////////////////////////////////// StyleFormatCondition conditionBlue = new StyleFormatCondition(); conditionBlue.Appearance.Options.UseForeColor = true; conditionBlue.Appearance.ForeColor = Color.Blue; conditionBlue.Condition = FormatConditionEnum.Expression; conditionBlue.Expression = "([NGAY_KET_THUC] >= [NGAY_KET_THUC_THUC_TE] and not(IsNull([NGAY_KET_THUC_THUC_TE]))) or(IsNull([NGAY_KET_THUC]) and not(IsNull([NGAY_KET_THUC_THUC_TE]))) "; conditionBlue.ApplyToRow = true; StyleFormatCondition conditionRed = new StyleFormatCondition(); conditionRed.Appearance.Options.UseForeColor = true; conditionRed.Appearance.ForeColor = Color.Red; conditionRed.Condition = FormatConditionEnum.Expression; conditionRed.Expression = "[NGAY_KET_THUC] < [NGAY_KET_THUC_THUC_TE] and not(IsNull([NGAY_KET_THUC]))"; conditionRed.ApplyToRow = true; gridViewMaster.FormatConditions.AddRange(new StyleFormatCondition[] { conditionBlue, conditionRed }); }
private void FormESOBJ_Load(object sender, EventArgs e) { InitCompany(); InitDevGridCustomButtons(); InitOthType(this.GetResType()); if (EPESCommon.AuthMode == AUTHMODE.MODE_CLASSIC) { this.xtraTabPageResGroup.PageVisible = false; this.chkAuth.Visible = false; this.chkOth.Visible = false; } //按钮操作模式 DataTable dt = new DataTable(); dt.Columns.Add("value").Caption = " "; dt.Columns.Add("desc").Caption = EP.EPES.EPESC0000030/*操作模式*/; dt.Rows.Add("A", EP.EPES.EPESC0000058/*单步操作*/); dt.Rows.Add("B", EP.EPES.EPESC0000032/*多步操作*/); RepositoryItemLookUpEdit repositoryItemLookUpEdit = new RepositoryItemLookUpEdit(); //RepositoryItemComboBox repositoryItemComboBox = new RepositoryItemComboBox(); if (repositoryItemLookUpEdit != null) { repositoryItemLookUpEdit.DataSource = dt; repositoryItemLookUpEdit.DisplayMember = "desc"; repositoryItemLookUpEdit.ValueMember = "value"; gridViewButtInfo.Columns["OPTYPE"].ColumnEdit = repositoryItemLookUpEdit; } this.fgDevGridFormInfo.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(FormInfoEmbeddedNavigator_ButtonClick); this.fgDevGridButtInfo.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(ButtInfoEmbeddedNavigator_ButtonClick); this.fgDevGridOth.EmbeddedNavigator.ButtonClick += new NavigatorButtonClickEventHandler(OthEmbeddedNavigator_ButtonClick); //获取当前系统中所有的APPNAME信息 EI.EIInfo inBlockAPP = new EI.EIInfo(); EI.EIInfo outBlockAPP = new EI.EIInfo(); RepositoryItemComboBox repositoryItemComboBox = new RepositoryItemComboBox(); inBlockAPP.SetColName(1, "ename"); inBlockAPP.SetColVal(1, "ename", ""); outBlockAPP = EI.EITuxedo.CallService("epesappinfo", inBlockAPP); if (outBlockAPP.sys_info.flag != 0) { MessageBox.Show(string.Format(EP.EPES.EPESC0000061/*获取APPNAME信息错误:{0}*/, outBlockAPP.sys_info.msg)); return; } string stemp = ""; for (int i = 0; i < outBlockAPP.blk_info[0].Row; i++) { stemp = outBlockAPP.GetColVal(1, i + 1, "ename") + ": " + outBlockAPP.GetColVal(1, i + 1, "cname"); comboApp.Properties.Items.Add(stemp); repositoryItemComboBox.Items.Add(outBlockAPP.GetColVal(1, i + 1, "ename")); } gridViewFormInfo.Columns["APPNAME"].ColumnEdit = repositoryItemComboBox; repositoryItemComboBox.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor; if (outBlockAPP.blk_info[0].Row > 0) { comboApp.SelectedIndex = 0; } //设置checkbox选中行样式 DevExpress.Skins.Skin currentSkin; currentSkin = DevExpress.Skins.CommonSkins.GetSkin(DevExpress.LookAndFeel.UserLookAndFeel.Dfgault); Color textColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.WindowText); Color highlightTextColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.HighligthText); Color selectColor = currentSkin.Colors.GetColor(DevExpress.Skins.CommonColors.Highlight); StyleFormatCondition cnForm; cnForm = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridFormInfo.SelectionColumn, null, false); cnForm.ApplyToRow = true; cnForm.Appearance.BackColor = Color.Empty; cnForm.Appearance.ForeColor = textColor; gridViewFormInfo.FormatConditions.Add(cnForm); cnForm = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridFormInfo.SelectionColumn, null, true); cnForm.ApplyToRow = true; cnForm.Appearance.BackColor = selectColor; cnForm.Appearance.ForeColor = highlightTextColor; gridViewFormInfo.FormatConditions.Add(cnForm); StyleFormatCondition cnBtn; cnBtn = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridButtInfo.SelectionColumn, null, false); cnBtn.ApplyToRow = true; cnBtn.Appearance.BackColor = Color.Empty; cnBtn.Appearance.ForeColor = textColor; gridViewButtInfo.FormatConditions.Add(cnBtn); cnBtn = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridButtInfo.SelectionColumn, null, true); cnBtn.ApplyToRow = true; cnBtn.Appearance.BackColor = selectColor; cnBtn.Appearance.ForeColor = highlightTextColor; gridViewButtInfo.FormatConditions.Add(cnBtn); StyleFormatCondition cnOth; cnOth = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridOth.SelectionColumn, null, false); cnOth.ApplyToRow = true; cnOth.Appearance.BackColor = Color.Empty; cnOth.Appearance.ForeColor = textColor; gridViewOthInfo.FormatConditions.Add(cnOth); cnOth = new StyleFormatCondition(FormatConditionEnum.Equal, fgDevGridOth.SelectionColumn, null, true); cnOth.ApplyToRow = true; cnOth.Appearance.BackColor = selectColor; cnOth.Appearance.ForeColor = highlightTextColor; gridViewOthInfo.FormatConditions.Add(cnOth); fgDevGridButtInfo.SetAllColumnEditable(false); fgDevGridFormInfo.SetAllColumnEditable(false); fgDevGridOth.SetAllColumnEditable(false); fgDevGridFormInfo.SelectionColumn.OptionsColumn.AllowEdit = true; fgDevGridButtInfo.SelectionColumn.OptionsColumn.AllowEdit = true; fgDevGridOth.SelectionColumn.OptionsColumn.AllowEdit = true; }
public override void InitColumDetail() { //Format dòng trên lưới StyleFormatCondition condition = new StyleFormatCondition(); condition.Appearance.Options.UseForeColor = true; condition.Appearance.ForeColor = Color.Red; condition.Condition = FormatConditionEnum.Expression; condition.Expression = string.Format(@"(AddDays(AddTimeSpan([NGAY_LAM_VIEC],#{0}#),1) <= [THOI_GIAN_GHI_NHAN]) AND [DUYET] == '1'", new TimeSpan(0, 0, 1)); condition.ApplyToRow = true; gridViewMaster.FormatConditions.Add(condition); }
private void InitGrid() { gridViewDetail._SetPermissionElement(BtnPrint, BtnExport); HelpPhieu.InitGrid(gridViewDetail, _isAdd); var edit = HelpGridColumn.CotSpinEdit(ColTapSo, QL_LICH_PHAT_SONG_CT.TAP_SO, 0); edit.MinValue = 1; edit.MaxValue = int.MaxValue; edit.AllowNullInput = DefaultBoolean.False; HelpGridColumn.CotTextLeft(ColMaBang, QL_LICH_PHAT_SONG_CT.MA_BANG); HelpGridColumn.CotDateEdit(ColGioPhat, QL_LICH_PHAT_SONG_CT.GIO_PHAT_SONG, "HH:mm"); HelpGridColumn.CotDateEdit(ColNgayPhat, QL_LICH_PHAT_SONG_CT.NGAY_PHAT_SONG, "dddd , " + FrameworkParams.option.dateFormat); ColNgayPhat.GroupFormat.FormatString = "dddd," + FrameworkParams.option.dateFormat; ColNgayPhat.GroupFormat.FormatType = FormatType.DateTime; AppCtrl.InitCotTimecode(ColThoiLuong, QL_LICH_PHAT_SONG_CT.THOI_LUONG, QL_LICH_PHAT_SONG_CT.THOI_LUONG_NUM); AppCtrl.InitCotThuTrongTuan(ColThuTrongTuan, QL_LICH_PHAT_SONG_CT.THU_TRONG_TUAN, true); HelpGridColumn.CotSpinEdit(ColSoTap, QL_LICH_PHAT_SONG_CT.SO_TAP_NGAY, 0); gridViewDetail.OptionsView.NewItemRowPosition = NewItemRowPosition.None; HelpGridColumn.CotTextLeft(ColTenTap, QL_LICH_PHAT_SONG_CT.TEN_TAP); HelpGridColumn.CotTextLeft(ColCodeBM, QL_LICH_PHAT_SONG_CT.CODE_BM); ColStart.Caption = " Dòng bắt đầu thay đổi thứ\nhoặc tập số/ngày(nếu có)"; gridViewDetail.ColumnPanelRowHeight = 70; ColStart.Width = 100; ColGioPhat.Caption = "Giờ\nphát sóng"; ColSoTap.Caption = "Số tập\n/ngày"; ColTapSo.Caption = "Tập\nsố"; foreach (GridColumn c in gridViewDetail.Columns) { c.AppearanceHeader.TextOptions.WordWrap = WordWrap.Wrap; c.AppearanceHeader.Options.UseTextOptions = true; } _itemCheck = HelpGridColumn.CotCheckEdit(ColStart, QL_LICH_PHAT_SONG_CT.IS_START); _itemCheck.CheckStyle = DevExpress.XtraEditors.Controls.CheckStyles.Radio; var fDelete = new StyleFormatCondition { Condition = FormatConditionEnum.Expression, ApplyToRow = true, Expression = "[STATE]='DEL'" }; fDelete.Appearance.BackColor = Color.Silver; fDelete.Appearance.ForeColor = Color.Gainsboro; fDelete.Appearance.Options.UseBackColor = true; fDelete.Appearance.Options.UseForeColor = true; gridViewDetail.FormatConditions.Add(fDelete); var fAdd = new StyleFormatCondition { Condition = FormatConditionEnum.Expression, ApplyToRow = true, Expression = "[STATE]='ADD'" }; fAdd.Appearance.BackColor = Color.PaleGreen; fAdd.Appearance.Options.UseBackColor = true; gridViewDetail.FormatConditions.Add(fAdd); if (_isAdd != null) { var fStart = new StyleFormatCondition { Condition = FormatConditionEnum.Expression, ApplyToRow = true, Expression = "[" + QL_LICH_PHAT_SONG_CT.IS_START + "]='Y'" }; fStart.Appearance.BackColor = Color.DarkOrange; fStart.Appearance.Options.UseBackColor = true; gridViewDetail.FormatConditions.Add(fStart); lblStart.BackColor = fStart.Appearance.BackColor; } lblDel.BackColor = fDelete.Appearance.BackColor; lblAdd.BackColor = fAdd.Appearance.BackColor; gridViewDetail.FocusedRowChanged += GridViewDetailFocusedRowChanged; gridViewDetail.RowCellClick += gridViewDetail_RowCellClick; gridViewDetail.FocusedColumnChanged += gridViewDetail_FocusedColumnChanged; }
private void ConditionsAdjustment_not_equal(string col, int thr) { StyleFormatCondition cn; cn = new StyleFormatCondition(FormatConditionEnum.NotEqual, gridView2.Columns[col], null, thr); cn.Appearance.BackColor = Color.Red; cn.Appearance.ForeColor = Color.White; gridView2.FormatConditions.Add(cn); }
public override void InitColumnMaster() { this.gridViewMaster.OptionsBehavior.AutoExpandAllGroups = true; gridViewMaster.OptionsView.ColumnAutoWidth = true; gridViewThongTinLienHe.OptionsView.ColumnAutoWidth = true; gridViewMaster.OptionsSelection.MultiSelect = false; HelpGridColumn.CotTextLeft(CotCongViec, "CONG_VIEC"); HelpGridExt1.colMultiline(CotNguoiThucHien, "NV_THAM_GIA"); HelpGridColumn.CotTextLeft(CotTenDuAn, "TEN_DU_AN"); HelpGridColumn.CotTextLeft(CotKhachHang, "TEN_KHACH_HANG"); CotTenDuAn.Visible = false; CotKhachHang.Visible = false; CotNgayKetThucDuKien.Visible = false; HelpGridColumn.CotTextLeft(CotLoaiCongViec, "TEN_LCV"); HelpGridColumn.CotTextCenter(CotDouutien, "TEN_MUC_UU_TIEN"); HelpGridColumn.CotCombobox(CotTinhtrang,HelpDB.getDBService().LoadTable("DM_TINH_TRANG"),"ID","NAME","TINH_TRANG_ID"); HelpGridColumn.CotTextRight(CotTienDo, "TONG_TIEN_DO"); HelpGridColumn.CotTextLeft(Cotnguoigiao, "TEN_NGUOI_GIAO"); XtraGridSupportExt.DateTimeGridColumn(Cotbatdau, "TU_NGAY"); XtraGridSupportExt.DateTimeGridColumn(CotNgayKetThucDuKien, "DEN_NGAY");//ngay kt du kien XtraGridSupportExt.DateTimeGridColumn(Cotngayketthuc, "NGAY_KET_THUC"); XtraGridSupportExt.TextCenterColumn(CotTGdutinh, "THOI_GIAN_DU_KIEN"); gridViewMaster.OptionsView.ShowGroupPanel = false; ////////////////////////////////////// StyleFormatCondition conditionBlue = new StyleFormatCondition(); conditionBlue.Appearance.Options.UseForeColor = true; conditionBlue.Appearance.ForeColor = Color.Blue; conditionBlue.Condition = FormatConditionEnum.Expression; conditionBlue.Expression = "([DEN_NGAY] >= [NGAY_KET_THUC] and not(IsNull([NGAY_KET_THUC]))) or(IsNull([DEN_NGAY]) and not(IsNull([NGAY_KET_THUC]))) "; conditionBlue.ApplyToRow = true; StyleFormatCondition conditionRed = new StyleFormatCondition(); conditionRed.Appearance.Options.UseForeColor = true; conditionRed.Appearance.ForeColor = Color.Red; conditionRed.Condition = FormatConditionEnum.Expression; conditionRed.Expression = "[DEN_NGAY] < [NGAY_KET_THUC] and not(IsNull([DEN_NGAY]))"; conditionRed.ApplyToRow = true; gridViewMaster.FormatConditions.AddRange(new StyleFormatCondition[] { conditionBlue, conditionRed }); }
public override void InitColumDetail() { #region column phản hồi XtraGridSupportExt.TextLeftColumn(colNguoi_gui_PH, "N_GUI"); XtraGridSupportExt.TextLeftColumn(colNguoi_nhan_PH, "N_NHAN"); HelpGridColumn.CotReadOnlyDate(colTG_Gui_PH, "NGAY_GUI", PLConst.FORMAT_DATETIME_STRING); #endregion #region column layout tài liệu layoutView1.Appearance.CardCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; layoutView1.OptionsBehavior.AllowSwitchViewModes = true; layoutView1.OptionsBehavior.AllowExpandCollapse = true; lvGhi_chu.OptionsColumn.ReadOnly = true; layoutView1.OptionsView.ShowCardCaption = true; layoutView1.OptionsHeaderPanel.EnableCustomizeButton = false; layoutView1.OptionsCustomization.AllowSort = false; layoutView1.OptionsCustomization.AllowFilter = false; XtraGridSupportExt.TextLeftColumn(lvTieuDe, "TIEU_DE"); XtraGridSupportExt.TextLeftColumn(lvFile_dinh_kem, "TEN_FILE"); XtraGridSupportExt.TextLeftColumn(lvNguoiCapNhat, "TEN_NGUOI_CN"); XtraGridSupportExt.TextLeftColumn(lvNgayCapNhat, "NGAY_CAP_NHAT"); HelpGridColumn.CotCalcEditDec(lvSize, "SIZE", 3, true); HelpGridColumn.CotMemoExEdit(lvGhi_chu, "GHI_CHU"); XtraGridSupportExt.TextLeftColumn(cot_luufile, "luu_file"); XtraGridSupportExt.TextLeftColumn(cot_mofile, "mo_file"); repositoryItemMemoExEdit1.ReadOnly = true; repositoryItemMemoExEdit1.ScrollBars = ScrollBars.Both; StyleFormatCondition conditionRed = new StyleFormatCondition(); conditionRed.Appearance.Options.UseForeColor = true; conditionRed.Appearance.ForeColor = Color.Red; conditionRed.Condition = FormatConditionEnum.Expression; conditionRed.Expression = "[TYPE_ID] == 10"; conditionRed.Column = lvFile_dinh_kem; layoutView1.FormatConditions.Add(conditionRed); #endregion }
/// <summary> /// /// <summary> /// ����ijһ�е�ֵ����gridview�и��е���ɫ,����ȱ�ݵȼ����Ƿ����������ֶ� /// ʹ���ֳɵķ��� /// </summary> /// </summary> /// <param name="gcErrType"></param> private void SetRowColor(GridColumn gcErrType, GridColumn gcIsException) { StyleFormatCondition styleFormatCondition1 = new StyleFormatCondition(); styleFormatCondition1.Appearance.ForeColor = Color.Red; styleFormatCondition1.Appearance.Options.UseBackColor = true; styleFormatCondition1.Appearance.Options.UseForeColor = true; styleFormatCondition1.ApplyToRow = true; styleFormatCondition1.Column = gcErrType; styleFormatCondition1.Condition = FormatConditionEnum.Equal; styleFormatCondition1.Value1 = "����ȱ��"; StyleFormatCondition styleFormatCondition2 = new StyleFormatCondition(); //styleFormatCondition2.Appearance.BackColor = System.Drawing.Color.Red; styleFormatCondition2.Appearance.ForeColor = Color.Orange; styleFormatCondition2.Appearance.Options.UseBackColor = true; styleFormatCondition2.Appearance.Options.UseForeColor = true; styleFormatCondition2.ApplyToRow = true; styleFormatCondition2.Column = gcErrType; styleFormatCondition2.Condition = FormatConditionEnum.Equal; styleFormatCondition2.Value1 = "��ȱ��"; StyleFormatCondition styleFormatCondition3 = new StyleFormatCondition(); styleFormatCondition3.Appearance.ForeColor = Color.YellowGreen; styleFormatCondition3.Appearance.Options.UseBackColor = true; styleFormatCondition3.Appearance.Options.UseForeColor = true; styleFormatCondition3.ApplyToRow = true; styleFormatCondition3.Column = gcErrType; styleFormatCondition3.Condition = FormatConditionEnum.Equal; styleFormatCondition3.Value1 = "��ȱ��"; if (gcIsException.Visible) { StyleFormatCondition styleFormatCondition4 = new StyleFormatCondition(); styleFormatCondition4.Appearance.Font = new Font("Tahoma", 8.25F, FontStyle.Strikeout); styleFormatCondition4.Appearance.ForeColor = SystemColors.ControlDark; styleFormatCondition4.Appearance.Options.UseFont = true; styleFormatCondition4.Appearance.Options.UseForeColor = true; styleFormatCondition4.ApplyToRow = true; styleFormatCondition4.Column = gcIsException; styleFormatCondition4.Condition = FormatConditionEnum.Equal; styleFormatCondition4.Value1 = true; gvResult.FormatConditions.AddRange(new StyleFormatCondition[] { styleFormatCondition1, styleFormatCondition2, styleFormatCondition3, styleFormatCondition4 }); } else { gvResult.FormatConditions.AddRange(new StyleFormatCondition[] { styleFormatCondition1, styleFormatCondition2, styleFormatCondition3 }); } }
private void Init() { barButtonItemView.Glyph = FWImageDic.VIEW_IMAGE20; barButtonItemExport.Glyph = HelpImage.getImage2020("ExportToExcel.png"); barButtonItemClose.Glyph = FWImageDic.CLOSE_IMAGE20; TNSHelper.InitCtrlKenhPhatCpp(KenhPhat); TNSHelper.InitCtrlTargetCpp(Target); TNSHelper.InitCtrlThiTruongCpp(ThiTruong); HelpGrid.SetReadOnly(GridViewDetail); var date = DateTime.Today; TuThang.Value = 1; TuNam.Value = date.Year; DenThang.Value = 12; DenNam.Value = date.Year; var st = new StyleFormatCondition { ApplyToRow = true, Condition = FormatConditionEnum.Expression, Expression = GroupTypeEqualExpression(SummaryRow) }; st.Appearance.Options.UseFont = true; st.Appearance.Font = new Font(st.Appearance.Font, FontStyle.Bold); GridViewDetail.FormatConditions.Add(st); }
//public event FeatureChangedHandler SelectedReferFeatureChanged; //private void SendFeatureChangedEvent(IFeature selErrorFeature) //{ // if (this.SelectedErrorFeatureChanged != null) // this.SelectedErrorFeatureChanged.Invoke(selErrorFeature); //} /// <summary> /// ����ijһ�е�ֵ����gridview�и��е���ɫ /// ʹ���ֳɵķ��� /// </summary> private void SetExceptionColor(GridColumn gc) { StyleFormatCondition styleFormatCondition4 = new StyleFormatCondition(); styleFormatCondition4.Appearance.Font = new Font("Tahoma", 8.25F, FontStyle.Strikeout); styleFormatCondition4.Appearance.ForeColor = SystemColors.ControlDark; styleFormatCondition4.Appearance.Options.UseFont = true; styleFormatCondition4.Appearance.Options.UseForeColor = true; styleFormatCondition4.ApplyToRow = true; styleFormatCondition4.Column = gc; styleFormatCondition4.Condition = FormatConditionEnum.Equal; styleFormatCondition4.Value1 = true; gvResult.FormatConditions.AddRange(new StyleFormatCondition[] { styleFormatCondition4 }); }
public void InitGridCongViec_QLKH() { #region grid Công việc HelpGridColumn.CotTextLeft(CotLoaiCongViec, "LCV_ID"); HelpGridColumn.CotTextLeft(Congviec, "CONG_VIEC"); HelpGridColumn.CotTextLeft(Cotnguoigiao, "NGUOI_GIAO"); HelpGridExt1.colMultiline(CotNguoiThucHien, "NV_THAM_GIA"); HelpGridColumn.CotTextCenter(CotTienDo, "TONG_TIEN_DO"); HelpGridColumn.CotDateEdit(Cotbatdau, "NGAY_BAT_DAU"); HelpGridColumn.CotDateEdit(Cotngayketthuc, "NGAY_KET_THUC"); HelpGridColumn.CotDateEdit(cotNgayKTTT, "NGAY_KTTT"); HelpGridColumn.CotDateEdit(CotTGdutinh, "THOI_GIAN_DU_KIEN"); XtraGridSupportExt.TextLeftColumn(CotDouutien, "TEN_MUC_UU_TIEN"); XtraGridSupportExt.TextLeftColumn(CotTinhtrang, "TINH_TRANG"); ///////////////////////////// StyleFormatCondition conditionBlue = new StyleFormatCondition(); conditionBlue.Appearance.Options.UseForeColor = true; conditionBlue.Appearance.ForeColor = Color.Blue; conditionBlue.Condition = FormatConditionEnum.Expression; conditionBlue.Expression = "([NGAY_KET_THUC] >= [NGAY_KTTT] and not(IsNull([NGAY_KTTT]))) or(IsNull([NGAY_KET_THUC]) and not(IsNull([NGAY_KTTT]))) "; conditionBlue.ApplyToRow = true; StyleFormatCondition conditionRed = new StyleFormatCondition(); conditionRed.Appearance.Options.UseForeColor = true; conditionRed.Appearance.ForeColor = Color.Red; conditionRed.Condition = FormatConditionEnum.Expression; conditionRed.Expression = "[NGAY_KET_THUC] < [NGAY_KTTT] and not(IsNull([NGAY_KET_THUC]))"; conditionRed.ApplyToRow = true; gridViewCongviec.FormatConditions.AddRange(new StyleFormatCondition[] { conditionBlue, conditionRed }); #endregion #region layout Dự án XtraGridSupportExt.TextLeftColumn(colTen_DA, "NAME"); XtraGridSupportExt.TextLeftColumn(colLoaiDA, "TEN_DA"); XtraGridSupportExt.TextLeftColumn(colNguoi_QL, "TEN_NGUOI_QL"); XtraGridSupportExt.TextLeftColumn(colT_trang, "TINH_TRANG"); XtraGridSupportExt.TextLeftColumn(colNgay_BD_DA, "NGAY_BAT_DAU"); XtraGridSupportExt.TextLeftColumn(colNgayKT, "NGAY_KET_THUC_THUC_TE"); XtraGridSupportExt.TextLeftColumn(codT_do_DA, "TIEN_DO"); XtraGridSupportExt.TextLeftColumn(colXem_DA, "XEM_DA"); XtraGridSupportExt.TextLeftColumn(colTao_CV, "TAO_CV"); XtraGridSupportExt.TextLeftColumn(colXoa_DA, "XOA_DA"); XtraGridSupportExt.TextLeftColumn(colSua_DA, "SUA_DA"); layoutViewDuAn.OptionsHeaderPanel.EnableCustomizeButton = false; layoutViewDuAn.OptionsCustomization.AllowSort = false; layoutViewDuAn.OptionsCustomization.AllowFilter = false; layoutViewDuAn.OptionsBehavior.AllowSwitchViewModes = true; layoutViewDuAn.OptionsBehavior.AllowExpandCollapse = true; layoutViewDuAn.OptionsView.ShowCardCaption = true; layoutViewDuAn.Appearance.CardCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near; #endregion #region layout tài liệu XtraGridSupportExt.TextLeftColumn(lvTieuDe, "TIEU_DE"); XtraGridSupportExt.TextLeftColumn(lvFile_dinh_kem, "TEN_FILE"); XtraGridSupportExt.TextLeftColumn(lvNguoiCapNhat, "TEN_NGUOI_CN"); XtraGridSupportExt.TextLeftColumn(lvNgayCapNhat, "NGAY_CAP_NHAT"); HelpGridColumn.CotMemoExEdit(lvGhi_chu, "GHI_CHU"); XtraGridSupportExt.TextLeftColumn(cotID, "ID"); HelpGridColumn.CotTextLeft(lvSize, "SIZE"); XtraGridSupportExt.TextLeftColumn(cot_xoa, "xoa_file"); XtraGridSupportExt.TextLeftColumn(cot_luufile, "luu_file"); XtraGridSupportExt.TextLeftColumn(cot_mofile, "mo_file"); XtraGridSupportExt.TextLeftColumn(cot_suafile, "sua_file"); lvGhi_chu.OptionsColumn.ReadOnly = true; layoutView1.OptionsCustomization.AllowSort = false; layoutView1.OptionsCustomization.AllowFilter = false; layoutView1.OptionsBehavior.AllowSwitchViewModes = true; layoutView1.OptionsBehavior.AllowExpandCollapse = true; layoutView1.OptionsView.ShowCardCaption = true; layoutView1.Appearance.CardCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; #endregion #region grid GhiNhatKy HelpGridColumn.CotReadOnlyDate(colTGCapNhat, "THOI_GIAN_CAP_NHAT", PLConst.FORMAT_DATETIME_STRING); HelpGridColumn.CotTextLeft(colNguoiCapNhat, "NGUOI_THUC_HIEN"); HelpGridColumn.CotMemoExEdit(colNoiDung, "GHI_CHU"); gridViewNhatKy.OptionsBehavior.Editable = true; colNoiDung.OptionsColumn.AllowEdit = true; colNoiDung.OptionsColumn.ReadOnly = true; #endregion }
/// <summary> /// Khởi tạo định dạng lỗi trên Grid /// </summary> /// <param name="grid">Grid cần khởi tạo định dạng lỗi</param> public void AddFormatCond(PLGridView grid) { DataSet ds = ((DataTable)grid.GridControl.DataSource).DataSet; //Khởi tạo cột Check GridColumn colCheck = new GridColumn(); colCheck.FieldName = "CHECK"; colCheck.Visible = false; if (!ds.Tables[0].Columns.Contains("CHECK")) ds.Tables[0].Columns.Add("CHECK"); if (!grid.Columns.Contains(colCheck)) grid.Columns.Add(colCheck); //Khởi tạo cột thông báo vi phạm GridColumn colVipham = new GridColumn(); colVipham.FieldName = "VI_PHAM"; colVipham.Visible = false; if (!ds.Tables[0].Columns.Contains("VI_PHAM")) ds.Tables[0].Columns.Add("VI_PHAM"); if (!grid.Columns.Contains(colVipham)) grid.Columns.Add(colVipham); StyleFormatCondition styleFormatCond = new StyleFormatCondition(); styleFormatCond.Appearance.BackColor = System.Drawing.Color.Red; styleFormatCond.Appearance.Options.UseBackColor = true; styleFormatCond.ApplyToRow = true; styleFormatCond.Column = colCheck; styleFormatCond.Condition = DevExpress.XtraGrid.FormatConditionEnum.Equal; styleFormatCond.Value1 = 0; grid.FormatConditions.AddRange(new StyleFormatCondition[] { styleFormatCond }); }
/// <summary> /// Đặt màu sắc của cột tùy vào điều kiện được đặt ở dưới lưới /// </summary> public static void SetCondition( GridView xtraGridView, string columnName, FormatConditionEnum[] formatConditionEnum, object[] Value1s, object[] Value2s, Object[] formatAppearance) { StyleFormatCondition temp = new StyleFormatCondition(); //Chọn cột định dạng temp.Column = xtraGridView.Columns[columnName]; //Đặt điều kiện for (int i = 0; i < formatConditionEnum.Length; i++) { Object TmpformatAppearance = null; if (formatAppearance.Length == 1) TmpformatAppearance = formatAppearance[0]; else TmpformatAppearance = formatAppearance[i]; //Chọn kiểu định dạng if (TmpformatAppearance is DevExpress.Utils.AppearanceObject) { temp.Appearance.Assign((DevExpress.Utils.AppearanceObject)TmpformatAppearance); } else { temp.Appearance.BackColor = ((System.Drawing.Color)TmpformatAppearance); temp.Appearance.Options.UseBackColor = true; } temp.Condition = formatConditionEnum[i]; temp.Value1 = Value1s[i]; if(Value2s[i] != null) temp.Value2 = Value2s[i]; xtraGridView.FormatConditions.Add(temp); } }
public override void InitColumDetail() { StyleFormatCondition cn = new StyleFormatCondition(FormatConditionEnum.Equal, CotPrior, null, "Y"); cn.Appearance.ForeColor = Color.Red; cn.Appearance.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular); cn.ApplyToRow = true; gridViewMaster.FormatConditions.Add(cn); }
public override void InitColumDetail() { #region column gridViewCongViec gridViewThongTinLienHe.OptionsBehavior.AutoExpandAllGroups = true; gridViewThongTinLienHe.OptionsView.ShowAutoFilterRow = false; gridViewThongTinLienHe.OptionsView.ColumnAutoWidth = true; gridViewCongviec.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None; gridViewThongTinLienHe.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None; HelpGridColumn.CotTextLeft(colCong_viec, "CONG_VIEC"); HelpGridExt1.colMultiline(colNguoi_TH, "NV_THAM_GIA"); HelpGridColumn.CotTextLeft(colLoaiCV, "TEN_LCV"); HelpGridColumn.CotTextLeft(colDo_UT, "TEN_MUC_UU_TIEN"); HelpGridColumn.CotTextLeft(colTinh_trang, "TINH_TRANG"); HelpGridColumn.CotTextCenter(ColTien_Do, "TONG_TIEN_DO"); HelpGridColumn.CotTextLeft(colNguoi_giao, "TEN_NGUOI_GIAO"); XtraGridSupportExt.DateTimeGridColumn(colNgay_bat_dau, "TU_NGAY"); XtraGridSupportExt.DateTimeGridColumn(colNgay_ket_thucDuKien, "DEN_NGAY"); XtraGridSupportExt.DateTimeGridColumn(cotNgayKT, "NGAY_KET_THUC"); XtraGridSupportExt.TextCenterColumn(colTG_DT, "THOI_GIAN_DU_KIEN"); //////////////////////////////////////////////// StyleFormatCondition conditionBlue = new StyleFormatCondition(); conditionBlue.Appearance.Options.UseForeColor = true; conditionBlue.Appearance.ForeColor = Color.Blue; conditionBlue.Condition = FormatConditionEnum.Expression; conditionBlue.Expression = "([DEN_NGAY] >= [NGAY_KET_THUC] and not(IsNull([NGAY_KET_THUC]))) or(IsNull([DEN_NGAY]) and not(IsNull([NGAY_KET_THUC]))) "; conditionBlue.ApplyToRow = true; StyleFormatCondition conditionRed = new StyleFormatCondition(); conditionRed.Appearance.Options.UseForeColor = true; conditionRed.Appearance.ForeColor = Color.Red; conditionRed.Condition = FormatConditionEnum.Expression; conditionRed.Expression = "[DEN_NGAY] < [NGAY_KET_THUC] and not(IsNull([DEN_NGAY]))"; conditionRed.ApplyToRow = true; gridViewThongTinLienHe.FormatConditions.AddRange(new StyleFormatCondition[] { conditionBlue, conditionRed }); #endregion #region column layoutViewTaiLieu XtraGridSupportExt.TextLeftColumn(lvTieuDe, "TIEU_DE"); XtraGridSupportExt.TextLeftColumn(lvFile_dinh_kem, "TEN_FILE"); XtraGridSupportExt.TextLeftColumn(lvNguoiCapNhat, "TEN_NGUOI_CN"); XtraGridSupportExt.TextLeftColumn(lvNgayCapNhat, "NGAY_CAP_NHAT"); HelpGridColumn.CotTextLeft(lvSize, "SIZE"); HelpGridColumn.CotMemoExEdit(lvGhi_chu, "GHI_CHU"); lvGhi_chu.OptionsColumn.ReadOnly = true; XtraGridSupportExt.TextLeftColumn(cot_luufile, "luu_file"); XtraGridSupportExt.TextLeftColumn(cot_mofile, "mo_file"); layoutView1.OptionsHeaderPanel.EnableCustomizeButton = false; layoutView1.OptionsCustomization.AllowSort = false; layoutView1.OptionsCustomization.AllowFilter = false; layoutView1.OptionsBehavior.AllowSwitchViewModes = true; layoutView1.OptionsBehavior.AllowExpandCollapse = true; layoutView1.OptionsView.ShowCardCaption = true; layoutView1.Appearance.CardCaption.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; #endregion #region Column gridGhiNhatKy HelpGridColumn.CotReadOnlyDate(colTGCapNhat, "THOI_GIAN_CAP_NHAT", PLConst.FORMAT_DATETIME_STRING); HelpGridColumn.CotTextLeft(colNguoiCapNhat, "NGUOI_THUC_HIEN"); HelpGridColumn.CotMemoExEdit(colNoiDung, "GHI_CHU"); HelpGrid.SetReadOnlyHaveMemoCtrl(gridViewNhatKyDA); #endregion }
void frmListCanhBaoQL_Load(object sender, EventArgs e) { this.PLBuildQueryFilter(); StyleFormatCondition sMT1 = new StyleFormatCondition(FormatConditionEnum.Equal); sMT1.Appearance.BackColor = Color.DodgerBlue; sMT1.Appearance.Options.UseBackColor = true; sMT1.Value1 = 1; sMT1.ApplyToRow = true; sMT1.Column = Col_MT_LoaiCB; StyleFormatCondition sMT2 = new StyleFormatCondition(FormatConditionEnum.Equal); sMT2.Appearance.BackColor = Color.Yellow; sMT2.Appearance.Options.UseBackColor = true; sMT2.Value1 = 2; sMT2.ApplyToRow = true; sMT2.Column = Col_MT_LoaiCB; StyleFormatCondition sMT3 = new StyleFormatCondition(FormatConditionEnum.Equal); sMT3.Appearance.BackColor = Color.Tomato; sMT3.Appearance.Options.UseBackColor = true; sMT3.Value1 = 3; sMT3.ApplyToRow = true; sMT3.Column = Col_MT_LoaiCB; gridViewMuonTra.FormatConditions.Add(sMT1); gridViewMuonTra.FormatConditions.Add(sMT2); gridViewMuonTra.FormatConditions.Add(sMT3); StyleFormatCondition sRUN1 = new StyleFormatCondition(FormatConditionEnum.Equal); sRUN1.Appearance.BackColor = Color.DodgerBlue; sRUN1.Appearance.Options.UseBackColor = true; sRUN1.Value1 = 1; sRUN1.ApplyToRow = true; sRUN1.Column = Col_RUN_LoaiCB; StyleFormatCondition sRUN2 = new StyleFormatCondition(FormatConditionEnum.Equal); sRUN2.Appearance.BackColor = Color.Yellow; sRUN2.Appearance.Options.UseBackColor = true; sRUN2.Value1 = 2; sRUN2.ApplyToRow = true; sRUN2.Column = Col_RUN_LoaiCB; StyleFormatCondition sRUN3 = new StyleFormatCondition(FormatConditionEnum.Equal); sRUN3.Appearance.BackColor = Color.Tomato; sRUN3.Appearance.Options.UseBackColor = true; sRUN3.Value1 = 3; sRUN3.ApplyToRow = true; sRUN3.Column = Col_RUN_LoaiCB; gridViewSoRun.FormatConditions.Add(sRUN1); gridViewSoRun.FormatConditions.Add(sRUN2); gridViewSoRun.FormatConditions.Add(sRUN3); StyleFormatCondition sBQ1 = new StyleFormatCondition(FormatConditionEnum.Equal); sBQ1.Appearance.BackColor = Color.Tomato; sBQ1.Appearance.Options.UseBackColor = true; sBQ1.Value1 = 1; sBQ1.ApplyToRow = true; sBQ1.Column = Col_CT_LoaiCB; StyleFormatCondition sBQ2 = new StyleFormatCondition(FormatConditionEnum.Equal); sBQ2.Appearance.BackColor = Color.Yellow; sBQ2.Appearance.Options.UseBackColor = true; sBQ2.Value1 = 2; sBQ2.ApplyToRow = true; sBQ2.Column = Col_CT_LoaiCB; StyleFormatCondition sBQ3 = new StyleFormatCondition(FormatConditionEnum.Equal); sBQ3.Appearance.BackColor = Color.DodgerBlue; sBQ3.Appearance.Options.UseBackColor = true; sBQ3.Value1 = 3; sBQ3.ApplyToRow = true; sBQ3.Column = Col_CT_LoaiCB; gridViewMaster.FormatConditions.Add(sBQ1); gridViewMaster.FormatConditions.Add(sBQ2); gridViewMaster.FormatConditions.Add(sBQ3); }
private void Init() { btnPrint = new SimpleButton(); barButtonItemView.Glyph = FWImageDic.VIEW_IMAGE20; barButtonItemExport.Glyph = HelpImage.getImage2020("ExportToExcel.png"); barButtonItemClose.Glyph = FWImageDic.CLOSE_IMAGE20; TNSHelper.InitCtrlKenhPhatRev(KenhPhat); TNSHelper.InitCtrlTargetRev(Target); TNSHelper.InitCtrlThiTruongRev(ThiTruong); TNSHelper.InitCtrlAdvertiserRev(Advertiser); TNSHelper.InitCtrlAgencyRev(Agency); TNSHelper.InitCtrlBrandRev(Brand); TNSHelper.InitCtrlGroupRev(Group); TNSHelper.InitCtrlSectorRev(Sector); HelpGrid.SetReadOnly(GridViewDetail); var date = DateTime.Today; TuThang.Value = 1; TuNam.Value = date.Year; DenThang.Value = 12; DenNam.Value = date.Year; InitColBase(); var st = new StyleFormatCondition { ApplyToRow = true, Condition = FormatConditionEnum.Expression, Expression = "TIMEBAND like '%Grand Total%'" }; st.Appearance.Options.UseFont = true; st.Appearance.Font = new Font(st.Appearance.Font, FontStyle.Bold); GridViewDetail.FormatConditions.Add(st); GridViewDetail._SetPermissionElement(btnPrint, barButtonItemExport); }
private void AddFormat() { gridViewMaster.FormatConditions.Clear(); StyleFormatCondition ff = new StyleFormatCondition(); ff.Condition = DevExpress.XtraGrid.FormatConditionEnum.Expression; ff.ApplyToRow = true; ff.Expression = "[EMPTY]='N'"; ff.Appearance.BackColor = System.Drawing.Color.Silver; // ff.Appearance.ForeColor = System.Drawing.Color.Gainsboro; ff.Appearance.Options.UseBackColor = true; ff.Appearance.Options.UseForeColor = true; gridViewMaster.FormatConditions.Add(ff); }