Ejemplo n.º 1
0
        private void toolStripButton_ShiftDown_Click(object sender, EventArgs e)
        {
            DataGridView shadowDgv = GenericGridFunctions.DataGridViewColAndRowDataCopy(this.dataGridView_pixelGrid);

            for (int b = 0; b < this.dataGridView_pixelGrid.RowCount; b++)
            {
                for (int a = 0; a < this.dataGridView_pixelGrid.ColumnCount; a++)
                {
                    if (b == 0)
                    {
                        this.dataGridView_pixelGrid.Rows[b].Cells[a].Style.BackColor = shadowDgv.Rows[(this.dataGridView_pixelGrid.RowCount - 1)].Cells[a].Style.BackColor;
                    }
                    else
                    {
                        this.dataGridView_pixelGrid.Rows[b].Cells[a].Style.BackColor = shadowDgv.Rows[b - 1].Cells[a].Style.BackColor;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void toolStripButton_ShiftLeft_Click(object sender, EventArgs e)
        {
            //shift coloumn data left 1 coloumn
            DataGridView shadowDgv = GenericGridFunctions.DataGridViewColAndRowDataCopy(this.dataGridView_pixelGrid);

            for (int a = 0; a < this.dataGridView_pixelGrid.ColumnCount; a++)
            {
                for (int b = 0; b < this.dataGridView_pixelGrid.RowCount; b++)
                {
                    if (a == (this.dataGridView_pixelGrid.ColumnCount - 1))
                    {
                        //get the first column data
                        this.dataGridView_pixelGrid.Rows[b].Cells[a].Style.BackColor = shadowDgv.Rows[b].Cells[0].Style.BackColor;
                    }
                    else
                    {
                        this.dataGridView_pixelGrid.Rows[b].Cells[a].Style.BackColor = shadowDgv.Rows[b].Cells[a + 1].Style.BackColor;
                    }
                }
            }
        }