/// <summary> /// 重绘整个标签栏 /// </summary> /// <param name="g"></param> public void RenderTheBar(Graphics g) { // 先把已关闭的form对应的tab删除,对新加的form则为其创建相应tab CheckTabItemsWithOwnerMdiForm(); if (_listTabItems.Count > 0) { // 按照指定方式为每个tab分配空间 CalculateSpaceForEachTab(); SetTabsVisibility(); } SetTabsAndBarButtonBounds(); RenderEachBarItem(g); if (ShowNewTabBtn) { if (_lastMouseUpLocation != Point.Empty) { //gdu debug: currently we need this to set the btn back to normal if (!NewTabBtnBounds.Contains(_lastMouseUpLocation) && _newTabBtn.State == GMButtonState.Hover) { _newTabBtn.MouseOperation(_lastMouseUpLocation, MouseOperationType.Move); } } } }
/// <summary> /// 处理鼠标事件。该方法会触发一些click事件,重刷一些按钮等 /// </summary> /// <param name="location"></param> /// <param name="type"></param> public void MouseOperation(Point location, MouseOperationType type) { //if (type == MouseOperationType.Up) _lastMouseUpLocation = location; //else // _lastMouseUpLocation = Point.Empty; if (ShowNewTabBtn) { _newTabBtn.MouseOperation(location, type); } if (_hiddenTabsCount > 0 || AlwaysShowListAllBtn) { _listAllBtn.MouseOperation(location, type); } foreach (MdiGMTabItem tab in _listTabItems) { if (!tab.IsHidden) { tab.CloseBtn.MouseOperation(location, type); } } switch (type) { case MouseOperationType.Down: MouseOperationDown(location); break; case MouseOperationType.Up: MouseOperationUp(location); break; } }
public void MouseOperation(Point location, MouseOperationType type) { closeBtn.MouseOperation(location, type); if (maxBtn != null && maxBtn.Visible) { maxBtn.MouseOperation(location, type); } if (resBtn != null && resBtn.Visible) { resBtn.MouseOperation(location, type); } if (minBtn != null) { minBtn.MouseOperation(location, type); } }