在xtragrid和Scheduler之间拖放 [英] Drag and Drop between xtragrid and Scheduler

查看:162
本文介绍了在xtragrid和Scheduler之间拖放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何从栅格控件和调度器控件之间拖放数据从devexpress?我想从网格拖动数据并将其放在调度器上。演示中的devexpress示例不适用于我。我只是得到一个块符号。



认为

解决方案

得到它。

  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视图)
{
预约终端= 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;
}


someone can tell me how to drag and drop data between gridcontrol and schedulercontrol from devexpress? I want to drag the data from the grid and drop it on the scheduler. The devexpress example in the demo doesnt work for me. I just get a block-symbol.

regards

解决方案

I got it.

 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;
    }

这篇关于在xtragrid和Scheduler之间拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆