コード例 #1
0
 public CellsMergingEventArgs(DrawnTableCell firstCell, DrawnTableCell secondCell, DrawnTableCell resultCell)
 {
     FirstCell  = firstCell;
     SecondCell = secondCell;
     ResultCell = resultCell;
 }
コード例 #2
0
 public CellPastedEventArgs(DrawnTableCell copiedFrom, CellLocation location) : base(location)
 {
     CopiedFrom = copiedFrom;
 }
コード例 #3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (!Table.IsEnabled || mouseDown == null)
            {
                base.OnMouseDown(e);
                return;
            }

            copyMode_DrugDrop = false;
            copySource        = null;
            action            = InteractAction.None;
            allowDrop         = true;
            dragCoord         = Table.GetCellLocation(e.Location);
            interactWith      = Table.Cells[e.Location];
            if (interactWith != null && interactWith.Enabled)
            {
                if (interactWith is DrawnTableCell && Table.CellCopyMode == DrawnTableCopyMode.CtrlAndDrag && ModifierKeys.HasFlag(Keys.Control))
                {
                    copySource = interactWith;
                    DrawnTableCell clone = (DrawnTableCell)interactWith.Clone();
                    Table.OnCellCopied(new CellCopiedEventArgs(clone));
                    interactWith      = clone;
                    copyMode_DrugDrop = true;
                }

                action    = InteractAction.Click;
                dragCoord = interactWith.Location;
                if (Table.AllowDragDrop) // || copyMode_DrugDrop
                {
                    Table.dRedrawEx.Join();
                    Table.dRedrawEx.Pause();

                    lock (Table.table)
                    {
                        dragBackground = (Bitmap)Table.table.Clone();
                    }
                    using Graphics g = GetGraphics(dragBackground);

                    Table.DrawBackColors(g);

                    // Drawing cells
                    foreach (DrawnTableCell item in Table.Cells)
                    {
                        if (item == interactWith && !copyMode_DrugDrop)
                        {
                            continue;
                        }
                        Table.DrawCell(item, g);
                    }

                    Table.dRedrawEx.Resume();
                }
            }
            else if (Table.AllowCreateNewCells)
            {
                CellLocation?cLoc = Table.GetCellLocation(e.Location);
                if (cLoc != null && Table.Cells[(CellLocation)cLoc] == null)
                {
                    DrawnTableCell cell = new(cLoc.Value);
                    Table.Cells.Add(cell, false);
                    CellChangedEventArgs args = new(cLoc.Value);
                    Table.OnCellCreating(args);
                    if (!args.Handled)
                    {
                        action       = InteractAction.CellCreating;
                        interactWith = Table.Cells[cLoc.Value];
                        Table.Redraw();
                    }
                    else
                    {
                        Table.Cells.Remove(cLoc.Value);
                    }
                }
            }
            startDrag = e.Location;
            mouseDown = true;

            base.OnMouseDown(e);
        }
コード例 #4
0
 public CellCopiedEventArgs(DrawnTableCell copiedCell)
 {
     CopiedCell = copiedCell;
 }