Example #1
0
        void flowLayoutPanel1_DragDrop(object sender, DragEventArgs e)
        {
            DraggableUserControl data         = (DraggableUserControl)e.Data.GetData(typeof(DraggableUserControl));
            FlowLayoutPanel      _destination = (FlowLayoutPanel)sender;
            FlowLayoutPanel      _source      = (FlowLayoutPanel)data.Parent;

            if (_source != _destination)
            {
                // Add control to panel
                _destination.Controls.Add(data);
                data.Size = new Size(_destination.Width, 50);

                // Reorder
                Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                var   item  = _destination.GetChildAtPoint(p);
                int   index = _destination.Controls.GetChildIndex(item, false);
                _destination.Controls.SetChildIndex(data, index);

                // Invalidate to paint!
                _destination.Invalidate();
                _source.Invalidate();
            }
            else
            {
                // Just add the control to the new panel.
                // No need to remove from the other panel, this changes the Control.Parent property.
                Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                var   item  = _destination.GetChildAtPoint(p);
                int   index = _destination.Controls.GetChildIndex(item, false);
                _destination.Controls.SetChildIndex(data, index);
                _destination.Invalidate();
            }
        }
Example #2
0
        private void MoveVignette(object sender, DragEventArgs e)
        {
            VignetteNV vignetteSource = e.Data.GetData("VignetteNV") as VignetteNV;

            FlowLayoutPanel flowlayoutpanelTemp = (FlowLayoutPanel)sender as FlowLayoutPanel;

            //Si le flowlayoutpanel correspond bien à celui du UserControl que l'on déplace
            //(On ne doit pouvoir déplacer que les Vignettes d'album dans les Albums et les vignettes de Photos dans les photos).
            if (vignetteSource.Parent == flowlayoutpanelTemp)
            {
                //On obtient le contrôle à la position où l'évènement "drop" a été enregistré.
                Point   p = flowlayoutpanelTemp.PointToClient(new Point(e.X, e.Y));
                Control vignetteDestination = flowlayoutpanelTemp.GetChildAtPoint(p);
                //On obtient l'index (la position) de ce conbtrôle
                int index = flowlayoutpanelTemp.Controls.GetChildIndex(vignetteDestination, false);
                //On déplace la vignette source à cette position
                flowlayoutpanelTemp.Controls.SetChildIndex(vignetteSource, index);
                //On "invalide" le flowlayoutpanelTemp afin de le redessiner.
                flowlayoutpanelTemp.Refresh();
                //flowlayoutpanelTemp.Invalidate();
                //on sauvegarde les modifications
                XML_Serialization.save_user_data();
            }

            //sinon, si le usercontrol est une PictureVignette et quelle est deplacée dans le flowlayoutpannel des albums
            else
            {
                if ((vignetteSource.Parent == AllPhotosGrid) && (flowlayoutpanelTemp == AlbumGrid))
                {
                    VignetteNVAlbum album;
                    VignetteNVPhoto photo;
                    //On obtient le contrôle à la position où l'évènement "drop" a été enregistré.
                    Point   p = flowlayoutpanelTemp.PointToClient(new Point(e.X, e.Y));
                    Control vignetteDestination = flowlayoutpanelTemp.GetChildAtPoint(p);
                    //On obtient l'index (la position) de ce conbtrôle
                    int index = flowlayoutpanelTemp.Controls.GetChildIndex(vignetteDestination, false);
                    //On ajoute la vignettePicture dans lalbum situé à cette position
                    album = (VignetteNVAlbum)flowlayoutpanelTemp.Controls[index];
                    photo = (VignetteNVPhoto)vignetteSource;
                    album.albumLinked.Pictures.Add(photo.pic);
                    album.refreshPreviewPicture();
                    //On "invalide" le flowlayoutpanelTemp afin de le redessiner.
                    flowlayoutpanelTemp.Refresh();
                    //flowlayoutpanelTemp.Invalidate();
                    //on sauvegarde les modifications
                    XML_Serialization.save_user_data();
                }
            }
        }
        private void itemListPanel_DragDrop(object sender, DragEventArgs e)
        {
            CheckListItemUserControl data = (CheckListItemUserControl)e.Data.GetData(typeof(CheckListItemUserControl));

            if (data == null)
            {
                return;
            }
            FlowLayoutPanel target = (FlowLayoutPanel)sender;
            FlowLayoutPanel source = (FlowLayoutPanel)data.Parent;

            if (source != target)
            {
                // Add control to panel
                target.Controls.Add(data);

                // Reorder
                Point p     = target.PointToClient(new Point(e.X, e.Y));
                var   item  = target.GetChildAtPoint(p);
                int   index = target.Controls.GetChildIndex(item, false);
                target.Controls.SetChildIndex(data, index);

                CheckListUserControl checkListUserControl = target.Parent.Parent.Parent as CheckListUserControl;
                Board.Data.ItemProp  _itemProp            = new Board.Data.ItemProp();
                _itemProp.Item_Checked     = data.itemProp.Item_Checked;
                _itemProp.Item_Description = data.itemProp.Item_Description;
                _itemProp.Item_Position    = index;
                _itemProp.CheckList_ID     = checkListUserControl.checkListProp.CheckList_ID;
                _itemProp.Item_ID          = data.itemProp.Item_ID;
                Board.Data.DataService.UpdateItem(_itemProp);
                OnReset();

                // Invalidate to paint!
                target.Invalidate();
                source.Invalidate();
            }
            else
            {
                // Just add the control to the new panel.
                // No need to remove from the other panel, this changes the Control.Parent property.
                Point p     = target.PointToClient(new Point(e.X, e.Y));
                var   item  = target.GetChildAtPoint(p);
                int   index = target.Controls.GetChildIndex(item, false);
                target.Controls.SetChildIndex(data, index);
                target.Invalidate();

                ResetItemPosition();
            }
        }
Example #4
0
        private void panel_DragDrop(object sender, DragEventArgs e)
        {
            if (!e.Data.GetDataPresent(typeof(string)))
            {
                return;
            }

            var name    = e.Data.GetData(typeof(string)) as string;
            var control = this.Controls.Find(name, true).FirstOrDefault();

            if (control != null)
            {
                FlowLayoutPanel targetContainer = (FlowLayoutPanel)sender;

                //move control
                control.Parent = targetContainer;

                // Reorder
                Point p     = targetContainer.PointToClient(new Point(e.X, e.Y));
                var   item  = targetContainer.GetChildAtPoint(p);
                int   index = targetContainer.Controls.GetChildIndex(item, false);
                targetContainer.Controls.SetChildIndex(control, index);
                targetContainer.Invalidate();
            }
        }
        private void flowMain_DragOver(object sender, DragEventArgs e)
        {
            SteamWorldSplitSettings setting     = (SteamWorldSplitSettings)e.Data.GetData(typeof(SteamWorldSplitSettings));
            FlowLayoutPanel         destination = (FlowLayoutPanel)sender;
            Point p     = destination.PointToClient(new Point(e.X, e.Y));
            var   item  = destination.GetChildAtPoint(p);
            int   index = destination.Controls.GetChildIndex(item, false);

            if (index == 0)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                e.Effect = DragDropEffects.Move;
                int oldIndex = destination.Controls.GetChildIndex(setting);
                if (oldIndex != index)
                {
                    destination.Controls.SetChildIndex(setting, index);
                    SetSplitDescription(setting, index - 1);
                    SetSplitDescription((SteamWorldSplitSettings)item, oldIndex - 1);
                    destination.Invalidate();
                }
            }
        }
        private void flowMain_DragOver(object sender, DragEventArgs e)
        {
            UserSplitSettings oldItem     = (UserSplitSettings)e.Data.GetData(typeof(UserSplitSettings));
            FlowLayoutPanel   destination = (FlowLayoutPanel)sender;
            Point             point       = destination.PointToClient(new Point(e.X, e.Y));
            UserSplitSettings newItem     = destination.GetChildAtPoint(point) as UserSplitSettings;
            int newIndex = destination.Controls.GetChildIndex(newItem, false);

            e.Effect = DragDropEffects.Move;
            int oldIndex = destination.Controls.GetChildIndex(oldItem);

            if (oldIndex != newIndex)
            {
                string segment = oldItem.UserSplit.Name;
                oldItem.UserSplit.Name = newItem.UserSplit.Name;
                newItem.UserSplit.Name = segment;
                Split split = Settings.Autosplits[oldIndex];
                Settings.Autosplits[oldIndex] = Settings.Autosplits[newIndex];
                Settings.Autosplits[newIndex] = split;
                oldItem.UpdateControls(false, false);
                newItem.UpdateControls(false, false);
                destination.Controls.SetChildIndex(oldItem, newIndex);
                destination.Invalidate();
            }
        }
Example #7
0
        void BindDragDropEvent()
        {
            flyContent.DragEnter += (s, a) =>
            {
                if (!IsDropableObject(a))
                {
                    return;
                }
                a.Effect = DragDropEffects.All;
            };

            flyContent.DragDrop += (s, a) =>
            {
                Views.UserControls.BeanUI beanUI = null;
                // https://www.codeproject.com/Articles/48411/Using-the-FlowLayoutPanel-and-Reordering-with-Drag
                if (a.Data.GetDataPresent("V2RayGCon.Views.UserControls.ServerUI"))
                {
                    var item = (VgcApis.Interfaces.IDropableControl)a.Data.GetData("V2RayGCon.Views.UserControls.ServerUI");
                    var bean = new Models.Data.Bean
                    {
                        title  = item.GetTitle(),
                        uid    = item.GetUid(),
                        status = item.GetStatus(),
                    };

                    foreach (Views.UserControls.BeanUI control in flyContent.Controls)
                    {
                        if (control.GetBean().uid == bean.uid)
                        {
                            // update title
                            control.SetTitle(bean.title);
                            return;
                        }
                    }

                    beanUI = new Views.UserControls.BeanUI(bean);
                    flyContent.Controls.Add(beanUI);
                }

                if (beanUI == null && a.Data.GetDataPresent(typeof(Views.UserControls.BeanUI)))
                {
                    beanUI = (Views.UserControls.BeanUI)
                             a.Data.GetData(typeof(Views.UserControls.BeanUI));
                }

                if (beanUI == null)
                {
                    return;
                }

                var destIndex = flyContent.Controls.GetChildIndex(
                    flyContent.GetChildAtPoint(
                        flyContent.PointToClient(
                            new Point(a.X, a.Y))),
                    false);
                flyContent.Controls.SetChildIndex(beanUI, destIndex);

                ResetFlyContentItemsIndex();
            };
        }
        void DoDragDrop(object sender, DragEventArgs e)
        {
            Control         data         = (Control)e.Data.GetData(e.Data.GetFormats()[0]);
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;
            //   FlowLayoutPanel _source=(FlowLayoutPanel)data.Parent;

            //if ( _source!=_destination )
            //{
            //    // Add control to panel
            //    _destination.Controls.Add( data );
            //    data.Size=new Size( _destination.Width , 50 );

            //    // Reorder
            //    Point p=_destination.PointToClient( new Point( e.X , e.Y ) );
            //    var item=_destination.GetChildAtPoint( p );
            //    int index=_destination.Controls.GetChildIndex( item , false );
            //    _destination.Controls.SetChildIndex( data , index );

            //    // Invalidate to paint!
            //    _destination.Invalidate();
            //    _source.Invalidate();
            //}
            //else
            //{
            // Just add the control to the new panel.
            // No need to remove from the other panel, this changes the Control.Parent property.
            Point p     = _destination.PointToClient(new Point(e.X, e.Y));
            var   item  = _destination.GetChildAtPoint(p);
            int   index = _destination.Controls.GetChildIndex(item, false);

            _destination.Controls.SetChildIndex(data, index);
            _destination.Invalidate();
            //   }
        }
Example #9
0
        private void RuleLayout_DragDrop(object sender, DragEventArgs e)
        {
            RuleButton      button       = (RuleButton)e.Data.GetData(typeof(RuleButton));
            FlowLayoutPanel destination  = (FlowLayoutPanel)sender;
            Point           target_spot  = destination.PointToClient(new Point(e.X, e.Y));
            int             target_index = destination.Controls.GetChildIndex(destination.GetChildAtPoint(target_spot));

            destination.Controls.SetChildIndex(button, target_index);
            destination.Refresh();
        }
Example #10
0
        protected void ocultarControlesTurno(object sender, EventArgs e)
        {
            flpTurno = sender as FlowLayoutPanel;
            Object[] controles = flpTurno.Controls.Find("flpControlesTurno", true);
            flpControles = (FlowLayoutPanel)controles[0];

            //punto respecto a la pantalla
            Point xy = new Point(Cursor.Position.X, Cursor.Position.Y);
            //punto respecto al cliente (flpTurno)
            Point raton = new Point(flpTurno.PointToClient(xy).X, flpTurno.PointToClient(xy).Y);
            int   x0    = 0;
            int   x1    = rectanguloFlpTurno.Width;
            int   y0    = 0;
            int   y1    = rectanguloFlpTurno.Height;

            if (raton.X < x0 || raton.Y < y0 || raton.X > x1 || raton.Y > y1)
            {
                flpControles.Visible = false;
            }
        }
Example #11
0
        private void checkListPanel_DragDrop(object sender, DragEventArgs e)
        {
            CheckListUserControl data = (CheckListUserControl)e.Data.GetData(typeof(CheckListUserControl));

            if (data == null)
            {
                return;
            }
            FlowLayoutPanel target = (FlowLayoutPanel)sender;
            FlowLayoutPanel source = (FlowLayoutPanel)data.Parent;

            if (source != target)
            {
                // Add control to panel
                target.Controls.Add(data);

                // Reorder
                Point p     = target.PointToClient(new Point(e.X, e.Y));
                var   item  = target.GetChildAtPoint(p);
                int   index = target.Controls.GetChildIndex(item, false);
                target.Controls.SetChildIndex(data, index);

                // Invalidate to paint!
                target.Invalidate();
                source.Invalidate();
            }
            else
            {
                // Just add the control to the new panel.
                // No need to remove from the other panel, this changes the Control.Parent property.
                Point p     = target.PointToClient(new Point(e.X, e.Y));
                var   item  = target.GetChildAtPoint(p);
                int   index = target.Controls.GetChildIndex(item, false);
                target.Controls.SetChildIndex(data, index);
                target.Invalidate();

                ResetCheckListPos();
            }
        }
Example #12
0
        private void flpContentItems_DragDrop(object sender, DragEventArgs e)
        {
            PictureBox      data         = (PictureBox)e.Data.GetData(typeof(PictureBox));
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;

            Point p     = _destination.PointToClient(new Point(e.X, e.Y));
            var   item  = _destination.GetChildAtPoint(p);
            int   index = _destination.Controls.GetChildIndex(item, false);

            if (index >= 0)
            {
                MovePage(data.Name, index);
            }
        }
Example #13
0
        private void controlPanel_DragDrop(object sender, DragEventArgs e)
        {
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;
            var             c            = e.Data.GetData(typeof(WiserRoomControl)) as Control;
            // Just add the control to the new panel.
            // No need to remove from the other panel,
            // this changes the Control.Parent property.
            Point p     = _destination.PointToClient(new Point(e.X, e.Y));
            var   item  = _destination.GetChildAtPoint(p);
            int   index = _destination.Controls.GetChildIndex(item, false);

            _destination.Controls.SetChildIndex(c, index);
            _destination.Invalidate();
        }
Example #14
0
        protected bool LeftMouseDown(Point location)
        {
            if (!Visible || Parent == null)
            {
                return(false);
            }
            var control = OsFeatures.GlobalMouseHandler.GetCurrentControl();

            if (control != null)
            {
                while (control != null && control != this)
                {
                    control = control.Parent;
                }
                if (control == null)
                {
                    return(false);
                }
            }
            if (_closeButton.Bounds.Contains(PointToClient(location)))
            {
                return(false);
            }
            if (!Bounds.Contains(Parent.PointToClient(location)))
            {
                return(false);
            }

            if ((FindForm() is MainForm))
            {
                _dragging = Parent as IdePanel;
            }
            _dragOffset = location;
            if (Parent is IdeGroupedPanel groupedPanel)
            {
                foreach (var tab in groupedPanel.Tabs)
                {
                    if (tab.Button.Bounds.Contains(_tabPanel.PointToClient(location)))
                    {
                        _dragging = tab.Panel;
                    }
                }
            }

            return(false);
        }
Example #15
0
        public void MoveConverterIndex(MainWindow_PacketConverter control, Point pos_screen)
        {
            var index_old = Panel_ConverterList.Controls.GetChildIndex(control);
            var index_new = GetConverterIndex(Panel_ConverterList.PointToClient(pos_screen));

            if (index_new != index_old)
            {
                DebugManager.MessageOut(string.Format("MoveConverterIndex {0} => {1}", index_new, index_old));

                /* コントロールを入れ替え */
                Panel_ConverterList.Controls.SetChildIndex(control, (int)index_new);

                /* 変換器のインスタンスの順番も変更 */
                FormTaskManager.SetPacketConverterIndex(control.Instance, (int)index_new);

                ResumeLayout();
            }
        }
Example #16
0
        //flowlayout panellerin içine atmayı kabul ettirme
        void panel_DragDrop(object sender, DragEventArgs e)
        {
            Control         c           = e.Data.GetData(e.Data.GetFormats()[0]) as Control;
            FlowLayoutPanel destination = sender as FlowLayoutPanel;
            FlowLayoutPanel source      = (FlowLayoutPanel)c.Parent;

            if (c != null)
            {
                using (ProjectDBEntities db_entity = new ProjectDBEntities())
                {
                    Tasks currTask = db_entity.Tasks.FirstOrDefault(t => t.taskName == currControl.Name);
                    c.Location = destination.PointToClient(new Point(e.X, e.Y));

                    if (destination == flaypnlBacklog)
                    {
                        currTask.state = TaskState.Backlog;
                    }
                    else if (destination == flaypnlDoing)
                    {
                        currTask.state = TaskState.Doing;
                    }
                    else if (destination == flaypnlDone)
                    {
                        currTask.state = TaskState.Done;
                    }
                    else if (destination == flaypnlSprint)
                    {
                        currTask.state = TaskState.Sprint;
                    }
                    else if (destination == flaypnlTesting)
                    {
                        currTask.state = TaskState.Testing;
                    }
                    else if (destination == flaypnlToDo)
                    {
                        currTask.state = TaskState.ToDo;
                    }
                    destination.Controls.Add(c);
                    db_entity.SaveChanges();
                }
            }
        }
        private void FLP_All_Frame_DragDrop(object sender, DragEventArgs e)
        {
            PictureBox      picture      = (PictureBox)e.Data.GetData(typeof(PictureBox));
            FlowLayoutPanel _source      = (FlowLayoutPanel)picture.Parent;
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;

            Point p     = _destination.PointToClient(new Point(e.X, e.Y));
            var   item  = _destination.GetChildAtPoint(p);
            int   index = _destination.Controls.GetChildIndex(item, false);

            _destination.Controls.SetChildIndex(picture, index);
            _destination.Invalidate();
            if (index >= 0 && index < OGAnimationFrame.Count)
            {
                if (OGAnimationFrame[int.Parse(picture.Name)].NewIndex > index)
                {
                    for (int i = index; i < OGAnimationFrame.Count; i++)
                    {
                        OGAnimationFrame[i].OldIndex = OGAnimationFrame[i].NewIndex;
                        OGAnimationFrame[i].NewIndex = OGAnimationFrame[i].NewIndex + 1;
                    }
                }
                else if (OGAnimationFrame[int.Parse(picture.Name)].NewIndex < index)
                {
                    for (int i = index; i < OGAnimationFrame.Count; i++)
                    {
                        OGAnimationFrame[i].OldIndex = OGAnimationFrame[i].NewIndex;
                        OGAnimationFrame[i].NewIndex = OGAnimationFrame[i].NewIndex - 1;
                    }
                }
                OGAnimationFrame[int.Parse(picture.Name)].OldIndex = OGAnimationFrame[int.Parse(picture.Name)].NewIndex;
                OGAnimationFrame[int.Parse(picture.Name)].NewIndex = index;
                OGAnimationFrame = OGAnimationFrame.OrderBy(x => x.NewIndex).ToList();
                ClearTimelines();
                Sprite = OGAnimationFrame[int.Parse(picture.Name)].Image;
                PNL_Canvas.Invalidate();
                Update_Flow_Layout_Panel();
            }
        }
Example #18
0
        private void flowMain_DragOver(object sender, DragEventArgs e)
        {
            HollowKnightSplitSettings data        = (HollowKnightSplitSettings)e.Data.GetData(typeof(HollowKnightSplitSettings));
            FlowLayoutPanel           destination = (FlowLayoutPanel)sender;
            Point p     = destination.PointToClient(new Point(e.X, e.Y));
            var   item  = destination.GetChildAtPoint(p);
            int   index = destination.Controls.GetChildIndex(item, false);

            if (index == 0)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                e.Effect = DragDropEffects.Move;
                int oldIndex = destination.Controls.GetChildIndex(data);
                if (oldIndex != index)
                {
                    destination.Controls.SetChildIndex(data, index);
                    destination.Invalidate();
                }
            }
        }
Example #19
0
        void l_MouseUp(object sender, MouseEventArgs e)
        {
            Point           MP  = Control.MousePosition;
            FlowLayoutPanel FLP = null;

            Point mLoc1 = FLP1.PointToClient(MP);
            Point mLoc2 = FLP2.PointToClient(MP);
            Point mLoc3 = FLP3.PointToClient(MP);

            if (FLP1.ClientRectangle.Contains(mLoc1))
            {
                FLP = FLP1;
            }
            else if (FLP2.ClientRectangle.Contains(mLoc2))
            {
                FLP = FLP2;
            }
            else if (FLP3.ClientRectangle.Contains(mLoc3))
            {
                FLP = FLP3;
            }
            else
            {
                return;
            }
            mvLabel.SendToBack();
            Control cc      = FLP.GetChildAtPoint(FLP.PointToClient(MP));
            int     mvIndex = FLP.Controls.Count;

            if (cc != null)
            {
                mvIndex = FLP.Controls.IndexOf(cc);
            }
            FLP.Controls.Add(mvLabel);
            FLP.Controls.SetChildIndex(mvLabel, mvIndex);
            mvLabel = null;
        }
Example #20
0
        private void flowLayoutPanel_DragDrop(object sender, DragEventArgs e)
        {
            FlowLayoutPanel flowLayoutPanel = (FlowLayoutPanel)sender;
            MetroButton     data            = (MetroButton)e.Data.GetData(typeof(MetroButton));
            Point           p     = flowLayoutPanel.PointToClient(new Point(e.X, e.Y));
            var             item  = flowLayoutPanel.GetChildAtPoint(p);
            int             index = flowLayoutPanel.Controls.GetChildIndex(item, false);

            Debug.WriteLine(index);
            Debug.WriteLine(flowLayoutPanel.Controls.Count);

            // Hold place for 'Add new' button
            if (index == flowLayoutPanel.Controls.Count - 1)
            {
                index--;
            }
            else if (index == -1)
            {
                index = flowLayoutPanel.Controls.Count - 2;
            }

            flowLayoutPanel.Controls.SetChildIndex(data, index);
            flowLayoutPanel.Invalidate();
        }
Example #21
0
        private void flowLayoutPanel_DragDrop(object sender, DragEventArgs e)
        {
            //HarrProgressBar data = (HarrProgressBar)e.Data.GetData(typeof(HarrProgressBar));
            PB data = (PB)e.Data.GetData(typeof(PB));
            FlowLayoutPanel _destination = (FlowLayoutPanel)sender;
            FlowLayoutPanel _source      = (FlowLayoutPanel)data.Parent;

            Point p1 = _destination.PointToClient(new Point(e.X, e.Y));

            if (p1.Y > 0)
            {
                if (_destination == garbagePanel || _destination == TFLP)
                {
                    data.Dispose();
                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();

                    if (_source.Controls.Count <= 0)
                    {
                        if (_source.Parent.Controls.Count <= 2)
                        {
                            _source.Parent.Dispose();
                        }
                        else
                        {
                            _source.Dispose();
                        }
                    }
                    _destination.Invalidate();
                    _source.Invalidate();
                }
                else if (_source != _destination)
                {
                    // Add control to panel
                    _destination.Controls.Add(data);
                    //_destination.Width = _destination.Width - 8;
                    data.Size = new Size(_destination.Width - 2, data.Height);

                    // Reorder
                    Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                    var   item  = _destination.GetChildAtPoint(p);
                    int   index = _destination.Controls.GetChildIndex(item, false);
                    _destination.Controls.SetChildIndex(data, index);

                    // Invalidate to paint!
                    if (_source.Controls.Count <= 0)
                    {
                        if (_source.Parent.Controls.Count <= 2)
                        {
                            _source.Parent.Dispose();
                        }
                        else
                        {
                            _source.Dispose();
                        }
                    }
                    _source.Invalidate();
                    Console.WriteLine(_destination.Parent.ToString());
                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex = (Expander)_destination.Parent;
                    ex.Collapse();

                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();
                    _destination.Invalidate();
                    _source.Invalidate();
                }
                else
                {
                    // Just add the control to the new panel.
                    // No need to remove from the other panel,
                    // this changes the Control.Parent property.
                    Point p     = _destination.PointToClient(new Point(e.X, e.Y));
                    var   item  = _destination.GetChildAtPoint(p);
                    int   index = _destination.Controls.GetChildIndex(item, false);
                    _destination.Controls.SetChildIndex(data, index);


                    ExpanderApp.Expander ex = new ExpanderApp.Expander();
                    ex.Expand(); ex = new ExpanderApp.Expander();
                    ex = (Expander)_source.Parent;
                    ex.Collapse();
                    ex.Expand();
                    _destination.Invalidate();
                }
                FadeIn(TFLP, 1);
            }
            FadeIn(TFLP, 1);
            //garbagePanel.Visible = false;
        }