Exemple #1
0
        protected override void MaskRect_PreviewDragEnter(object sender, DragEventArgs e)
        {
            //base.MaskRect_PreviewDragEnter(sender, e);

            EndDrag();

            IBPageTabItem ti = e.Data.GetData(typeof(IBPageTabItem)) as IBPageTabItem;

            if (ti == null)
            {
                return;
            }

            if (ti == this)
            {
                return;
            }

            IBTabControl parentTC = Parent as IBTabControl;

            if (parentTC == null)
            {
                throw new IBLayoutException("IBPageTabItem の親が IBTabControl でありません");
            }

            IBTabControl parentTC2 = ti.Parent as IBTabControl;

            if (parentTC2 == null)
            {
                throw new IBLayoutException("IBPageTabItem の親が IBTabControl でありません");
            }

            if (parentTC == parentTC2)
            {
                parentTC.ReplaceItems(this, ti);
            }
            else
            {
                parentTC2.Items.Remove(ti);
                parentTC.Items.Insert(parentTC.Items.IndexOf(this), ti);

                if (isDummyItem)
                {
                    parentTC.Items.Remove(this);
                }

                if (parentTC2.Items.Count == 0)
                {
                    parentTC2.Items.Add(new IBPageTabItem()
                    {
                        isDummyItem = true, Header = "****"
                    });
                }
            }

            ti.IsSelected = true;
            parentTC.EndDrag();
        }
Exemple #2
0
        protected virtual void MaskRect_PreviewDragEnter(object sender, DragEventArgs e)
        {
            EndDrag();

            IBPageTabItem pti = e.Data.GetData(typeof(IBPageTabItem)) as IBPageTabItem;

            if (pti != null)
            {
                IsSelected = true;
            }

            IBTabItem ti = e.Data.GetData(typeof(IBTabItem)) as IBTabItem;

            if (ti == null)
            {
                return;
            }

            if (ti == this)
            {
                return;
            }

            IBTabControl parentTC = Parent as IBTabControl;

            if (parentTC == null)
            {
                throw new IBLayoutException("IBTabItem の親が IBTabControl でありません");
            }

            IBTabControl parentTC2 = ti.Parent as IBTabControl;

            if (parentTC2 == null)
            {
                throw new IBLayoutException("IBTabItem の親が IBTabControl でありません");
            }

            if (parentTC != parentTC2)
            {
                return;
            }

            parentTC.ReplaceItems(this, ti);
            ti.IsSelected = true;
            parentTC.EndDrag();
            parentTC.currentDropPos = Position.none;
        }