예제 #1
0
 /// <summary>
 /// Fires <see cref="TabStripItemClosing"/> event.
 /// </summary>
 /// <param name="e"></param>
 protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
 {
     if (TabStripItemClosing != null)
     {
         TabStripItemClosing(e);
     }
 }
예제 #2
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            HitTestResult result = HitTest(e.Location);

            if (result == HitTestResult.MenuGlyph)
            {
                HandledEventArgs args = new HandledEventArgs(false);
                OnMenuItemsLoading(args);

                if (!args.Handled)
                {
                    OnMenuItemsLoad(EventArgs.Empty);
                }

                ShowMenu();
            }
            else if (result == HitTestResult.CloseButton)
            {
                if (SelectedItem != null)
                {
                    TabStripItemClosingEventArgs args = new TabStripItemClosingEventArgs(SelectedItem);
                    OnTabStripItemClosing(args);
                    if (!args.Cancel && SelectedItem.CanClose)
                    {
                        RemoveTab(SelectedItem);
                        OnTabStripItemClosed(EventArgs.Empty);
                    }
                }
            }
            else if (result == HitTestResult.TabItem)
            {
                OMETabStripItem item = GetTabItemByPoint(e.Location);
                if (item != null)
                {
                    SelectedItem = item;
                }
            }

            Invalidate();
        }
예제 #3
0
		private void tabControlObjHierarchy_TabStripItemClosing(TabStripItemClosingEventArgs e)
		{
			if (detailsTabs.Controls.Count == 1)
				e.Cancel = true;
		}
예제 #4
0
		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown(e);

			if (e.Button != MouseButtons.Left)
				return;

			HitTestResult result = HitTest(e.Location);
			if (result == HitTestResult.MenuGlyph)
			{
				HandledEventArgs args = new HandledEventArgs(false);
				OnMenuItemsLoading(args);

				if (!args.Handled)
					OnMenuItemsLoad(EventArgs.Empty);

				ShowMenu();
			}
			else if (result == HitTestResult.CloseButton)
			{
				if (SelectedItem != null)
				{
					TabStripItemClosingEventArgs args = new TabStripItemClosingEventArgs(SelectedItem);
					OnTabStripItemClosing(args);
					if (!args.Cancel && SelectedItem.CanClose)
					{
						RemoveTab(SelectedItem);
						OnTabStripItemClosed(EventArgs.Empty);
					}
				}
			}
			else if (result == HitTestResult.TabItem)
			{
				OMETabStripItem item = GetTabItemByPoint(e.Location);
				if (item != null)
					SelectedItem = item;
			}

			Invalidate();
		}
예제 #5
0
		/// <summary>
		/// Fires <see cref="TabStripItemClosing"/> event.
		/// </summary>
		/// <param name="e"></param>
		protected internal virtual void OnTabStripItemClosing(TabStripItemClosingEventArgs e)
		{
			if (TabStripItemClosing != null)
				TabStripItemClosing(e);
		}