public NextPieceForm(BlocksGame bGame, BlocksForm bForm) { InitializeComponent(); game = bGame; gridNextPiece.AllowDragSelectedCols = false; gridNextPiece.AllowDragSelectedRows = false; gridNextPiece.AllowSelection = GridSelectionFlags.None; gridNextPiece.ResizeColsBehavior = GridResizeCellsBehavior.None; gridNextPiece.ResizeRowsBehavior = GridResizeCellsBehavior.None; form = bForm; this.Left = bForm.Right; this.Top = bForm.Top; }
// 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]); } } }