Ejemplo n.º 1
0
        private void GridView_DragDrop(object sender, DragEventArgs e)
        {
            DataGridView grid        = (DataGridView)sender;
            Point        clientPoint = grid.PointToClient(new Point(e.X, e.Y));

            rowIndexOfItemUnderMouseToDrop = grid.HitTest(clientPoint.X, clientPoint.Y).RowIndex;

            if (rowIndexOfItemUnderMouseToDrop == -1)
            {
                return;
            }

            if (e.Effect == DragDropEffects.Move)
            {
                DataGridViewRow rowToMove = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow;

                if (rowIndexOfItemUnderMouseToDrop >= (grid.RowCount - 1))                 // Blocca il drag fuori dalle celle salvate
                {
                    return;
                }

                if (rowIndexFromMouseDown >= (grid.RowCount - 1))                 // Blocca il drag di una cella non salvata
                {
                    return;
                }

                grid.Rows.RemoveAt(rowIndexFromMouseDown);
                grid.Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove);
                switch (grid.Name)
                {
                case "autolootdataGridView":
                    AutoLoot.CopyTable();
                    break;

                case "scavengerdataGridView":
                    Scavenger.CopyTable();
                    break;

                case "organizerdataGridView":
                    Organizer.CopyTable();
                    break;

                case "vendorbuydataGridView":
                    BuyAgent.CopyTable();
                    break;

                case "vendorsellGridView":
                    SellAgent.CopyTable();
                    break;

                case "restockdataGridView":
                    Restock.CopyTable();
                    break;

                case "graphfilterdatagrid":
                    RazorEnhanced.Filters.CopyGraphTable();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void GridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView grid = (DataGridView)sender;

            if (!grid.Focused)
            {
                return;
            }

            if (e.ColumnIndex == 0)             // Checkbox cambiate di stato genera save
            {
                switch (grid.Name)
                {
                case "autolootdataGridView":
                    AutoLoot.CopyTable();
                    break;

                case "scavengerdataGridView":
                    Scavenger.CopyTable();
                    break;

                case "organizerdataGridView":
                    Organizer.CopyTable();
                    break;

                case "vendorbuydataGridView":
                    BuyAgent.CopyTable();
                    break;

                case "vendorsellGridView":
                    SellAgent.CopyTable();
                    break;

                case "restockdataGridView":
                    Restock.CopyTable();
                    break;

                case "graphfilterdatagrid":
                    RazorEnhanced.Filters.CopyGraphTable();
                    break;

                case "journalfilterdatagrid":
                    RazorEnhanced.Filters.CopyJournalFilterTable();
                    break;
                }
            }
        }