0

有人可以告诉我如何从 devexpress 在 gridcontrol 和 schedulercontrol 之间拖放数据吗?我想从网格中拖动数据并将其放在调度程序上。演示中的 devexpress 示例对我不起作用。我只是得到一个块符号。

问候

4

1 回答 1

1

我得到了它。

 private void grdGrid_MouseDown(object sender, MouseEventArgs e)
        {
            posImGrid = null;

            GridHitInfo hitInfo = grvView.CalcHitInfo(new Point(e.X, e.Y));

            if (Control.ModifierKeys != Keys.None)
            {
                return;
            }

            if ((e.Button == System.Windows.Forms.MouseButtons.Left) &&
                (hitInfo.InRow) &&
                (hitInfo.HitTest != GridHitTest.RowIndicator))
            {
                posImGrid = hitInfo;
            }
        }

        private void grdGrid_MouseMove(object sender, MouseEventArgs e)
        {
            if ((e.Button == System.Windows.Forms.MouseButtons.Left) &&
                (posImGrid != null))
            {
                Size dragSize = SystemInformation.DragSize;
                Rectangle dragRect = new Rectangle(new Point(posImGrid.HitPoint.X - dragSize.Width / 2,
                                                             posImGrid.HitPoint.Y - dragSize.Height / 2), dragSize);

                if (!dragRect.Contains(new Point(e.X, e.Y)))
                {
                    grvView.GridControl.DoDragDrop(GetDragData(grvView), DragDropEffects.All);
                    posImGrid = null;
                }
            }
        }

        private SchedulerDragData GetDragData(GridView view)
    {
        Appointment termin = Storage.CreateAppointment(AppointmentType.Normal);
        clsMeineKlasse tempObjekt = (clsMeineKlasse)grvView.GetFocusedRow();
        termin.Description = tempObjekt.Beschreibung;
        termin.Subject = tempObjekt.Bezeichnung;
        termin.Duration = TimeSpan.FromHours(8);

        SchedulerDragData sdd = new SchedulerDragData(termin);

        return sdd;
    }
于 2013-01-02T16:01:48.813 回答