private void OnViewButtonClick(object sender, ViewButtonClickEventArgs e) { switch (e.Button) { case ViewButtonType.ScrollTabsLeft: if (_firstTabIndex != 0) { --_firstTabIndex; ResetButtons(); Invalidate(); } break; case ViewButtonType.ScrollTabsRight: if (_firstTabIndex < _tabs.Count - 1) { ++_firstTabIndex; ResetButtons(); Invalidate(); } break; case ViewButtonType.TabsMenu: case ViewButtonType.TabsScrollMenu: if (_tabs.Count != 0) { var menu = new ContextMenuStrip(); foreach (var tab in _tabs) { menu.Items.Add( new ToolStripMenuItem(tab.Text, tab.Image, (item, args) => { var view = (ViewBase)((ToolStripMenuItem)item).Tag; _viewHost.Activate(view); }) { Tag = tab.View, }); } Utility.MarkDropDownForAutoDispose(menu); var viewButtonSize = Renderer.ViewButtonSize; menu.Show(this, Width - viewButtonSize - 1, viewButtonSize + 4); } break; } }
protected override void OnMouseDown(MouseEventArgs e) { ViewHost.Activate(); if (Buttons.Count != 0) { var rc = GetButtonsRect(); if (rc.Contains(e.X, e.Y)) { var x = e.X - rc.X; var y = e.Y - rc.Y; Buttons.OnMouseDown(x, y, e.Button); } } base.OnMouseDown(e); }
public void Activate() { if (_host != null) { if (_host.Status == ViewHostStatus.AutoHide) { _host.DockSide.ActivateView(this); } else { _host.Activate(this); } } OnActivated(); }