private void Form1_Load(object sender, System.EventArgs e) { // configure grid _flex.Cols.Count = 2; _flex.Cols.Fixed = 0; _flex.Rows.Count = 1; C1.Win.C1FlexGrid.CellStyle s = _flex.Styles[C1.Win.C1FlexGrid.CellStyleEnum.Subtotal0]; s.BackColor = _flex.Styles.Normal.BackColor; s.ForeColor = _flex.Styles.Normal.ForeColor; // populate grid _flex[0, 0] = "Type"; _flex[0, 1] = "Item"; _flex.AddItem("Fruit\tApple"); _flex.AddItem("Fruit\tBanana"); _flex.AddItem("Fruit\tOrange"); _flex.AddItem("Fruit\tGrape"); _flex.AddItem("Meat\tSteak"); _flex.AddItem("Meat\tHamburger"); _flex.AddItem("Meat\tRib"); _flex.AddItem("Meat\tPot Roast"); _flex.AddItem("Salad\tGreen"); _flex.AddItem("Salad\tCaesar"); _flex.AddItem("Salad\tGreek"); _flex.AddItem("Salad\tSpinach"); #region C1FlexGridPrinter _flex.PrintCell += new C1.Win.C1FlexGrid.C1FlexGridPrintable2.PrintCellEventHandler(_flex_PrintCell); #endregion }
private void timer1_Tick(object sender, System.EventArgs e) { // toggle forecolor C1.Win.C1FlexGrid.CellStyle cs = _flex.Styles["Blink"]; cs.ForeColor = (cs.ForeColor == Color.Black) ? Color.Red : Color.Black; }
/// <summary> /// 设置错误单元格 /// </summary> /// <param name="c1FlexGrid1"></param> /// <param name="errorCell"></param> public static void SetErrorCell(C1.Win.C1FlexGrid.C1FlexGrid c1FlexGrid1, List <int[]> errorCell) { if (c1FlexGrid1.Styles["ErrorCell"] == null) { C1.Win.C1FlexGrid.CellStyle errorStyle = c1FlexGrid1.Styles.Add("ErrorCell"); errorStyle.BackColor = Color.Red; } foreach (int[] item in errorCell) { c1FlexGrid1.SetCellStyle(item[0] + 1, item[1] + 1, "ErrorCell"); } }
void Form1_Load(object sender, System.EventArgs e) { // get the data string strSelect = "select * from Products;"; string strConn = GetConnectionString(); OleDbDataAdapter da = new OleDbDataAdapter(strSelect, strConn); DataTable dt = new DataTable("Products"); da.Fill(dt); // bind to grid _flex.ShowCursor = true; _flex.Cols[0].Width = _flex.Rows.DefaultSize; _flex.DataSource = dt; // create custom style and use OwnerDraw to apply them C1.Win.C1FlexGrid.CellStyle s = _flex.Styles.Add("Critical"); s.BackColor = Color.DarkOrchid; s.ForeColor = Color.White; s.Font = new Font(_flex.Font, FontStyle.Bold); _flex.DrawMode = C1.Win.C1FlexGrid.DrawModeEnum.OwnerDraw; }
public ValeEntrega() { InitializeComponent(); cs = cfgArticulos.Styles.Add("Indicador"); }