private void TabMoved(object sender, TabStripTabMovedEventArgs e) { IComponentChangeService change=this.GetService(typeof(IComponentChangeService)) as IComponentChangeService; if(change!=null) { change.OnComponentChanging(this.Control,null); change.OnComponentChanged(this.Control,null,null,null); } }
protected virtual void InvokeTabMoved(TabStripTabMovedEventArgs e) { if(TabMoved!=null) TabMoved(this,e); }
private void tabStrip1_TabMoved(object sender, TabStripTabMovedEventArgs e) { InvokeTabMoved(e); }
private void tabControlMain_TabMoved(object sender, TabStripTabMovedEventArgs e) { if (e.NewIndex == 0 || e.OldIndex == 0) { e.Cancel = true; } }
private void TabStripTabMoved(object sender, TabStripTabMovedEventArgs e) { m_ItemContainer.SubItems._Remove((DockContainerItem)e.Tab.AttachedItem); m_ItemContainer.SubItems._Add((DockContainerItem)e.Tab.AttachedItem, e.NewIndex); m_TabsRearranged = true; }
public void InternalOnMouseMove(MouseEventArgs e) { if(m_TooltipTab!=null) { if(!m_TooltipTab.DisplayRectangle.Contains(e.X,e.Y)) { HideToolTip(); ResetHover(); } } if (m_HotTab != null) { if (m_HotTab.DisplayRectangle.Contains(e.X, e.Y)) m_HotTab.InvokeMouseMove(e); else { m_HotTab.InvokeMouseLeave(e); TabItem mouseOverTab = HitTest(e.X, e.Y); if (mouseOverTab != null) { mouseOverTab.InvokeMouseEnter(e); ResetHover(); } } } else { TabItem mouseOverTab = HitTest(e.X, e.Y); if (mouseOverTab != null) { mouseOverTab.InvokeMouseEnter(e); ResetHover(); } } if(this.HasNavigationBox && !TabDrag) { m_TabSystemBox.MouseMove(e); if(m_TabSystemBox.Visible && m_TabSystemBox.DisplayRectangle.Contains(e.X,e.Y)) { if(m_HotTab!=null) { if(m_Tabs.Contains(m_HotTab)) { InvalidateHotTab(); m_HotTab=null; this.Update(); } else m_HotTab=null; } return; } } if(m_DragBar!=null) { if(!m_DragBar.IsDisposed) m_DragBar.DragMouseMove(); return; } if(m_IsDragging) return; if(e.Button==MouseButtons.Left) { if (m_HotTab != null && m_HotTab.CloseButtonMouseOver) { m_HotTab.CloseButtonMouseOver = false; InvalidateHotTab(); } if(TabDrag) { if(this.DisplayRectangle.Contains(e.X,e.Y)) { if(m_CanReorderTabs || GetDesignMode()) { foreach(TabItem item in m_Tabs) { Rectangle r=item.DisplayRectangle; if(e.X<r.Right && (m_Alignment==eTabStripAlignment.Bottom || m_Alignment==eTabStripAlignment.Top)) r.Width=m_SelectedTab.DisplayRectangle.Width; else if(e.Y<r.Bottom && (m_Alignment==eTabStripAlignment.Left || m_Alignment==eTabStripAlignment.Right)) r.Height=m_SelectedTab.DisplayRectangle.Height; if(r.Contains(e.X,e.Y)) { if(m_SelectedTab==item) break; int index=m_Tabs.IndexOf(item); if(TabMoved!=null) { TabStripTabMovedEventArgs arg=new TabStripTabMovedEventArgs(m_SelectedTab,m_Tabs.IndexOf(m_SelectedTab),index); TabMoved(this,arg); if(arg.Cancel) break; } TabItem tabItem=m_SelectedTab; m_MovingTab=true; m_Tabs._Remove(tabItem); m_Tabs._Insert(index,tabItem); this.SelectedTab=tabItem; m_MovingTab=false; this.Refresh(); break; } } } } else { Rectangle r=this.DisplayRectangle; r.Inflate(16,16); if(!r.Contains(e.X,e.Y)) { int visibleTabCount=this.VisibleTabCount; if(this.Parent is Bar && ((Bar)this.Parent).CanTearOffTabs && (visibleTabCount>1 || visibleTabCount==1 && ((Bar)this.Parent).GrabHandleStyle==eGrabHandleStyle.None)) { TabDrag=false; m_IsDragging=true; // Very important to set this flag before calling StartTabDrag m_DragBar=((Bar)this.Parent).StartTabDrag(); if(m_DragBar!=null) { this.Capture=true; this.Refresh(); } else m_IsDragging=false; } } } } else if ((Math.Abs(e.X - _MouseDownPoint.X) >= 4 || Math.Abs(e.Y - _MouseDownPoint.Y) >= 4) && m_Tabs.Count > 0 && !this.IsMultiLine && this.CanReorderTabs) { TabDrag = true; } } else if(e.Button==MouseButtons.None) { Rectangle rSelected=this.GetSelectedTabRectangle(); if(rSelected.Contains(e.X,e.Y)) { SetHotTab(this.SelectedTab, e.X, e.Y); return; } else { foreach(TabItem tab in m_Tabs) { if(tab.DisplayRectangle.Contains(e.X,e.Y)) { SetHotTab(tab, e.X, e.Y); return; } } } SetHotTab(null,e.X,e.Y); } }