// Called by the Grid during an Update for each visible cell private void gridBoard_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { // Disallow editing e.Style.Enabled = false; if (e.ColIndex > 0 && e.RowIndex > 0) { if (game.IsGameRunning) { e.Style.Interior = GetGradient(game.GetBoardSquare(e.ColIndex, e.RowIndex)); } else { // Being able to see the board while paused is a significant advantage e.Style.BackColor = Color.White; } } // Add text to the CoveredCells for Game Over and Paused messages if (e.RowIndex == 6) { if (game.IsGameOver && e.ColIndex == 2) { e.Style.Text = "Game Over"; e.Style.Font = ArialFontInfo; } else if (!game.IsGameRunning && game.IsGameStarted && !game.IsGameOver && e.ColIndex == 3) { e.Style.Text = "Paused"; e.Style.Font = ArialFontInfo; } } }
void gridControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if (e.RowIndex == 0 || e.ColIndex == 0) { e.Style.Font.Bold = false; } }
public void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if (e.RowIndex <= 0 || e.ColIndex <= 0) { if (e.ColIndex == 0) { e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; } return; } GridModel gridModel = sender as GridModel; int index = this.tabBarSplitterControl.ActivePageIndex; IWorksheet sheet = workbook.Worksheets[index]; if (!e.Style.IsChanged && e.Style.IsEmpty) { if (sheet != null) { IRange range = sheet.Range; if (e.RowIndex >= range.Row && e.ColIndex >= range.Column) { IRange rangeToConvert = sheet.Range[e.RowIndex, e.ColIndex]; //Used to set the styles of the Excel cell to grid. excelConverter.ConvertExcelStyleToVirtualGridStyle(e.Style, sheet, rangeToConvert); } } } }
private void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if (e.Style.CellType != "ColumnHeaderCell" && (e.RowIndex % 2 == 0)) { e.Style.BackColor = Color.LightCyan; } else { e.Style.BackColor = Color.GhostWhite; } }
// This isn't fundamentally different from the QueryCellInfo in BlocksForm, except that // game.GetNextPiece() is used instead. private void gridNextPiece_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { e.Style.Enabled = false; if (e.ColIndex > 0 && e.RowIndex > 0) { if (game.IsGameOver || !game.IsGameRunning || !game.IsGameStarted) { e.Style.BackColor = Color.White; } else { e.Style.Interior = BlocksForm.GetGradient(game.GetNextPiece()[e.ColIndex - 1, e.RowIndex - 1]); } } }
private void GridItemJualProduk_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if (_listOfItemJual.Count > 0) { if (e.RowIndex > 0) { var rowIndex = e.RowIndex - 1; if (rowIndex < _listOfItemJual.Count) { var obj = _listOfItemJual[rowIndex]; var produk = obj.Produk; switch (e.ColIndex) { case 2: if (produk != null) { e.Style.CellValue = produk.nama_produk; } break; case 3: e.Style.HorizontalAlignment = GridHorizontalAlignment.Center; e.Style.CellValue = obj.jumlah - obj.jumlah_retur; break; case 4: e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; e.Style.CellValue = NumberHelper.NumberToString(obj.harga_jual); break; case 5: e.Style.HorizontalAlignment = GridHorizontalAlignment.Right; e.Style.CellValue = NumberHelper.NumberToString((obj.jumlah - obj.jumlah_retur) * obj.harga_jual); break; default: break; } // we handled it, let the grid know e.Handled = true; } } } }
/// <summary> /// Set the Background image based on the index /// </summary> void Grid_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e) { if (e.RowIndex == 1) { e.Style.BackgroundImage = this.imageList1.Images[0]; } else if (e.RowIndex == 2) { e.Style.BackgroundImage = this.imageList1.Images[1]; } else if (e.RowIndex == 3) { e.Style.BackgroundImage = this.imageList1.Images[2]; } else if (e.RowIndex == 4) { e.Style.BackgroundImage = this.imageList1.Images[3]; } else if (e.RowIndex == 5) { e.Style.BackgroundImage = this.imageList1.Images[4]; } else if (e.RowIndex == 6) { e.Style.BackgroundImage = this.imageList1.Images[5]; } else if (e.RowIndex == 7) { e.Style.BackgroundImage = this.imageList1.Images[6]; } else if (e.RowIndex == 8) { e.Style.BackgroundImage = this.imageList1.Images[7]; } else if (e.RowIndex == 9) { e.Style.BackgroundImage = this.imageList1.Images[8]; } else if (e.RowIndex == 10) { e.Style.BackgroundImage = this.imageList1.Images[9]; } else if (e.RowIndex == 11) { e.Style.BackgroundImage = this.imageList1.Images[10]; } else if (e.RowIndex == 12) { e.Style.BackgroundImage = this.imageList1.Images[11]; } else if (e.RowIndex == 13) { e.Style.BackgroundImage = this.imageList1.Images[12]; } else if (e.RowIndex == 14) { e.Style.BackgroundImage = this.imageList1.Images[13]; } else if (e.RowIndex == 15) { e.Style.BackgroundImage = this.imageList1.Images[14]; } else if (e.RowIndex == 16) { e.Style.BackgroundImage = this.imageList1.Images[15]; } e.Style.BackgroundImageMode = Syncfusion.Windows.Forms.Grid.GridBackgroundImageMode.Normal; }