コード例 #1
0
        // 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;
                }
            }
        }
コード例 #2
0
 void gridControl1_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
 {
     if (e.RowIndex == 0 || e.ColIndex == 0)
     {
         e.Style.Font.Bold = false;
     }
 }
コード例 #3
0
        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);
                    }
                }
            }
        }
コード例 #4
0
 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;
     }
 }
コード例 #5
0
 // 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]);
         }
     }
 }
コード例 #6
0
        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;
                    }
                }
            }
        }
コード例 #7
0
        /// <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;
        }