Ejemplo n.º 1
0
        protected override void OnDragDrop(DragEventArgs e)
        {
            if (e.Data.GetDataPresent(typeof(SelectedObjectCollection)))
            {
                object obj = e.Data.GetData(typeof(SelectedObjectCollection));

                if (obj != null)
                {
                    SelectedObjectCollection col = (SelectedObjectCollection)obj;

                    if (col.Count > 0)
                    {
                        object data = null;

                        if (col[0] is Patch)
                        {
                            Patch[] patches = new Patch[col.Count];

                            for (int i = 0; i < col.Count; i++)
                            {
                                patches[i] = (Patch)col[i];
                            }

                            data = patches;
                        }
                        else if (col[0] is PatchGroup)
                        {
                            PatchGroup[] groups = new PatchGroup[col.Count];

                            for (int i = 0; i < col.Count; i++)
                            {
                                groups[i] = (PatchGroup)col[i];
                            }

                            data = groups;
                        }

                        if (HandleDroppedData != null)
                        {
                            HandleDroppedData(data, e);
                        }
                    }
                }
            }
            else
            {
                base.OnDragDrop(e);
            }
        }
Ejemplo n.º 2
0
        protected override void OnDragDrop(DragEventArgs e)
        {
            if( e.Data.GetDataPresent(typeof(SelectedObjectCollection)) )
            {
                object obj = e.Data.GetData(typeof(SelectedObjectCollection));

                if( obj != null )
                {
                    SelectedObjectCollection col = (SelectedObjectCollection)obj;

                    if( col.Count > 0 )
                    {
                        object data = null;

                        if( col[0] is Patch )
                        {
                            Patch[] patches = new Patch[col.Count];

                            for( int i = 0; i < col.Count; i++ )
                                patches[i] = (Patch)col[i];

                            data = patches;
                        }
                        else if( col[0] is PatchGroup )
                        {
                            PatchGroup[] groups = new PatchGroup[col.Count];

                            for( int i = 0; i < col.Count; i++ )
                                groups[i] = (PatchGroup)col[i];

                            data = groups;
                        }

                        if( HandleDroppedData != null )
                            HandleDroppedData(data, e);
                    }
                }
            }
            else
                base.OnDragDrop(e);
        }