void OnCustomizeCell(CustomizeCellEventArgs e) {
     if (e.FieldName == "Total" && !e.IsSelected) {
         decimal total = Convert.ToDecimal(e.Value);
         if (total < 100)
             e.BackgroundColor = Color.Red;
         else if (total > 500)
             e.BackgroundColor = Color.Green;
         e.Handled = true;
     }
 }
 void OnCustomizeCell(CustomizeCellEventArgs e) {
     if (string.IsNullOrEmpty(searchText))
         return;
     string cellText = e.DisplayText.ToUpper();
     if (cellText.Contains(searchText.ToUpper()) && !e.IsSelected) {
         e.BackgroundColor = ThemeManager.Theme.CellCustomizer.HighlightColor;
         e.ForeColor = Color.Black;
         e.Handled = true;
     }
 }
 void OnCustomizeCell(CustomizeCellEventArgs e)
 {
     if (e.FieldName == "ErrorSincronizacion" && !e.IsSelected)
     {
         if (e.Value != null && !String.IsNullOrEmpty(e.Value.ToString()))
         {
             e.ForeColor = Color.Red;
         }
         e.Handled = true;
     }
 }
Example #4
0
 static void options_CustomizeCell(CustomizeCellEventArgs e)
 {
     // Substitute Boolean values within the Discontinued column by special symbols.
     if (e.ColumnFieldName == "Discontinued")
     {
         if (e.Value is bool)
         {
             e.Handled = true;
             e.Formatting.Alignment = aligmentForDiscontinuedColumn;
             e.Value = ((bool)e.Value) ? "☑" : "☐";
         }
     }
 }
Example #5
0
        void OnCustomizeCell(CustomizeCellEventArgs e)
        {
            if (string.IsNullOrEmpty(searchText))
            {
                return;
            }
            string cellText = e.DisplayText.ToUpper();

            if (cellText.Contains(searchText.ToUpper()) && !e.IsSelected)
            {
                e.BackgroundColor = ThemeManager.Theme.CellCustomizer.HighlightColor;
                e.ForeColor       = Color.Black;
                e.Handled         = true;
            }
        }
 void OnCustomizeCell(CustomizeCellEventArgs e)
 {
     if (e.FieldName == "Total" && !e.IsSelected)
     {
         int total = Convert.ToInt32(e.Value);
         if (total < 50)
         {
             e.ForeColor = Color.Red;
         }
         else if (total > 2000)
         {
             e.ForeColor = Color.Green;
         }
         e.Handled = true;
     }
 }
Example #7
0
 void OnCustomizeCell(CustomizeCellEventArgs e)
 {
     if (e.FieldName == "Total" && !e.IsSelected)
     {
         decimal total = Convert.ToDecimal(e.Value);
         if (total < 100)
         {
             e.BackgroundColor = Color.Red;
         }
         else if (total > 500)
         {
             e.BackgroundColor = Color.Green;
         }
         e.Handled = true;
     }
 }
Example #8
0
        void OnCustomizeCell(CustomizeCellEventArgs e)
        {
            if (e.FieldName == "TotalPrice" && !e.IsSelected)
            {
                decimal total = Convert.ToDecimal(e.Value.ToString());
                if (total < 850)
                {
                    e.ForeColor = Color.Red;
                }
                else if (total > 1400)
                {
                    e.ForeColor = Color.Green;
                }

                e.Handled = true;
            }
        }
Example #9
0
 private void dgvProducts_CustomizeCell(object sender, CustomizeCellEventArgs e)
 {
     if (dgvProducts.Rows.Count > 0)
     {
         if (!e.Cell.Header)
         {
             if (e.Cell.ColumnIndex == 1)
             {
                 var data = (ProductLocation)e.Cell.Row.Data;
                 if (data.ShopPrice != data.SalePrice)
                 {
                     e.Cell.Style = this.dgvProducts.Styles["styleRed"];
                 }
             }
         }
     }
 }
Example #10
0
 void gridCustomizeCell(CustomizeCellEventArgs e)
 {
     if (e.FieldName == "Total" && !e.IsSelected)
     {
         string name = (string)grid.GetCellValue(e.RowHandle, "Customer.Name");
         if (!String.IsNullOrEmpty(name) && name.StartsWith("ann", StringComparison.CurrentCultureIgnoreCase))
         {
             decimal total = Convert.ToDecimal(e.Value);
             if (total < 100)
             {
                 e.BackgroundColor = Color.Red;
             }
             else if (total > 1000)
             {
                 e.BackgroundColor = Color.Green;
             }
             e.Handled = true;
         }
     }
 }
Example #11
0
 private void sgStavka_CustomizeCell(object sender, CustomizeCellEventArgs e)
 {
     ObojiHizxicuGrida(e.Cell);
 }
Example #12
0
        void op_CustomizeCell(CustomizeCellEventArgs e)
        {
            long             _mark      = long.Parse((GVG.GetRowCellValue(e.RowHandle, "ID") ?? 0).ToString());
            XlCellFormatting formatting = new XlCellFormatting();

            formatting.Font      = new XlFont();
            formatting.Font.Bold = true;
            formatting.Font.Name = "Times New Roman";

            if (_mark == 0)
            {
                formatting.Border = XlBorder.OutlineBorders(Color.FromArgb(216, 228, 188));
                if (e.ColumnFieldName == "CongTy")
                {
                    formatting.Border.RightColor = Color.Black;
                }
                formatting.Fill         = XlFill.SolidFill(Color.FromArgb(216, 228, 188));
                e.Formatting.FormatType = FormatType.None;
                e.Value = string.Empty;
            }
            else
            {
                XlCellAlignment alignment = new XlCellAlignment();
                alignment.HorizontalAlignment = XlHorizontalAlignment.Center;
                alignment.VerticalAlignment   = XlVerticalAlignment.Center;

                if (e.AreaType == SheetAreaType.Header)
                {
                    e.Formatting.Alignment = alignment;
                    formatting.Fill        = XlFill.SolidFill(Color.DarkSeaGreen);
                    formatting.Font.Size   = 15;
                }
                else if (_mark == -1)
                {
                    formatting.Border = XlBorder.OutlineBorders(Color.DarkSeaGreen);
                    if (!"MaCho HanhTrinhDi MaHD SoVe".Contains(e.ColumnFieldName))
                    {
                        formatting.Border.RightColor = Color.Black;
                    }

                    formatting.Border.BottomColor = Color.Black;
                    formatting.Fill      = XlFill.SolidFill(Color.DarkSeaGreen);
                    formatting.Font.Size = 12;
                    if (e.ColumnFieldName == "HanhTrinhVe")
                    {
                        e.Value = "Tổng";
                    }
                    if ((e.Value ?? string.Empty).ToString() == "0")
                    {
                        e.Value = string.Empty;
                    }
                }
                else
                {
                    formatting.Fill = XlFill.SolidFill(Color.White);
                    if (e.Value is string)
                    {
                        e.Formatting.Alignment = alignment;
                    }
                }
            }
            e.Formatting.CopyFrom(formatting, FormatType.None);
            e.Handled = true;
        }