Пример #1
0
 private void tabControlMain_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     if (MessageBox.Show("Bạn chắc chắn muốn tắt?", "Xác nhân", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         TabItem tabitem = tabControlMain.SelectedTab;
         tabControlMain.Tabs.Remove(tabitem);
     }
 }
Пример #2
0
        /// <summary>
        /// Hàm đóng tab
        /// </summary>
        private void tabContent_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
        {
            // Lấy ra tab được chọn
            TabItem choseTab = tabContent.SelectedTab;
            string  tabName  = choseTab.Text;

            // Xóa bỏ tab
            tabContent.Tabs.Remove(choseTab);
        }
 private void tabMain_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     if (tabMain.SelectedTabIndex != 0)
     {
         if (MessageBox.Show("Bạn có muốn đóng tab " + tabMain.SelectedTab.Text, "Đóng tab", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
         {
             tabMain.Tabs.Remove(tabMain.SelectedTab);
         }
     }
 }
Пример #4
0
 private void TabctrlFrm_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     foreach (Form frm in this.MdiChildren)
     {
         if (frm.IsMdiContainer != true)
         {
             if (tabctrlFrm.SelectedTab.Text == frm.Text)
             {
                 //tabctrlFrm.Tabs.RemoveAt(tabctrlFrm.Tabs.IndexOf(tabctrlFrm.Tabs.Item(frm.Text)));
                 frm.Close();
                 break;
             }
         }
     }
 }
Пример #5
0
 private void TabCtrl_main_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     TabCtrl_main.Tabs.Remove(TabCtrl_main.SelectedTab);
 }
Пример #6
0
		protected virtual void InvokeTabItemClose(TabStripActionEventArgs e)
		{
			if(TabItemClose!=null)
				TabItemClose(this,e);
		}
Пример #7
0
 /// <summary>
 /// 关闭绘图
 /// </summary>
 /// <param name="sender">事件发送者</param>
 /// <param name="e">事件</param>
 private void tabControl1_TabItemClose(object sender, TabStripActionEventArgs e)
 {
     documentManager.CheckAndSaveFlowChart();
 }      
Пример #8
0
		protected virtual void InvokeNavigateForward(TabStripActionEventArgs e)
		{
			if(NavigateForward!=null)
				NavigateForward(this,e);
		}
Пример #9
0
		private void tabStrip1_TabItemClose(object sender, TabStripActionEventArgs e)
		{
			InvokeTabItemClose(e);

            if (!e.Cancel && m_AutoCloseTabs && !this.DesignMode)
            {
                TabItem tab = tabStrip1.SelectedTab;
                if (tab != null)
                {
                    tabStrip1.Tabs.Remove(tab);
                    Control c = tab.AttachedControl;
                    if (c != null)
                    {
                        if (this.Controls.Contains(c))
                            this.Controls.Remove(c);
                        c.Dispose();
                    }
                }
                this.RecalcLayout();
            }
		}
Пример #10
0
		public void ScrollForward()
		{
			if(NavigateForward!=null)
			{
				TabStripActionEventArgs action=new TabStripActionEventArgs();
				NavigateForward(this,action);
				if(action.Cancel)
					return;
			}

			int iOffset=0;
			TabItem lastItem=null;
            int start = 0, end = m_Tabs.Count, direction = 1;
            if (this.RightToLeft == RightToLeft.Yes)
            {
                start = m_Tabs.Count - 1;
                end = -1;
                direction = -1;
            }
            for (int i = start; i != end; i += direction)
            {
                TabItem item = m_Tabs[i];
				if(!item.Visible)
					continue;
				if(m_Alignment==eTabStripAlignment.Top || m_Alignment==eTabStripAlignment.Bottom)
				{
                    if (item.DisplayRectangle.X < 4 && this.RightToLeft == RightToLeft.No ||
                        item.DisplayRectangle.Right <= this.Width && this.RightToLeft == RightToLeft.Yes)
                        continue;
					lastItem=item;
					iOffset=item.DisplayRectangle.Width;
					if(item.DisplayRectangle.Right>this.Width-m_TabSystemBox.DefaultWidth)
						break;
				}
				else
				{
					if(item.DisplayRectangle.Y<4)
						continue;
					lastItem=item;
					iOffset=item.DisplayRectangle.Height;
					if(item.DisplayRectangle.Bottom>this.Height-m_TabSystemBox.DefaultWidth)
						break;
				}
			}
			
			if(lastItem!=null)
			{
				if(m_Alignment==eTabStripAlignment.Top || m_Alignment==eTabStripAlignment.Bottom)
				{
					if(lastItem.DisplayRectangle.Right+2<this.Width-m_TabSystemBox.DefaultWidth)
						return;
				}
				else
				{
					if(lastItem.DisplayRectangle.Bottom+2<this.Height-m_TabSystemBox.DefaultWidth)
						return;
				}
			}

			int iStart=m_ScrollOffset;
			int iEnd=m_ScrollOffset+iOffset;
			if(m_Alignment==eTabStripAlignment.Top || m_Alignment==eTabStripAlignment.Bottom)
			{
                if (iEnd > m_Tabs[m_Tabs.Count - 1].DisplayRectangle.Right + m_ScrollOffset && this.RightToLeft == RightToLeft.No)
                    iEnd = m_Tabs[m_Tabs.Count - 1].DisplayRectangle.Right + m_ScrollOffset + m_TabSystemBox.DefaultWidth;
                else if (iEnd < 0 && this.RightToLeft == RightToLeft.Yes)
                    iEnd = 0;
			}
			else
			{
				if(iEnd>m_Tabs[m_Tabs.Count-1].DisplayRectangle.Bottom+m_ScrollOffset)
					iEnd=m_Tabs[m_Tabs.Count-1].DisplayRectangle.Bottom+m_ScrollOffset+m_TabSystemBox.DefaultWidth;
			}

			if(m_Animate)
			{
				DateTime animationStart=DateTime.Now;
				for(int i=iStart;i<iEnd;i++)
				{
					this.ScrollOffset=i;
                    if (((TimeSpan)DateTime.Now.Subtract(animationStart)).TotalMilliseconds > 200)
						break;
				}
			}
			this.ScrollOffset=iEnd;
		}
Пример #11
0
		public void ScrollBackwards()
		{
			if(NavigateBack!=null)
			{
				TabStripActionEventArgs action=new TabStripActionEventArgs();
				NavigateBack(this,action);
				if(action.Cancel)
					return;
			}

			int iOffset=0;
			for(int i=m_Tabs.Count-1;i>=0;i--)
			{
				TabItem item=m_Tabs[i];
				if(!item.Visible)
					continue;
				if(m_Alignment==eTabStripAlignment.Top || m_Alignment==eTabStripAlignment.Bottom)
				{
					if(item.DisplayRectangle.X<4)
					{
						iOffset=-item.DisplayRectangle.Width;
                        if (m_Style == eTabStripStyle.OneNote || m_Style == eTabStripStyle.VS2005Document)
                            iOffset -= item.DisplayRectangle.Height;
						break;
					}
				}
				else
				{
					if(item.DisplayRectangle.Y<4)
					{
						iOffset=-item.DisplayRectangle.Height;
                        if (m_Style == eTabStripStyle.OneNote || m_Style == eTabStripStyle.VS2005Document)
                            iOffset -= item.DisplayRectangle.Height;
						break;
					}
				}
			}
            if (iOffset == 0 && m_ScrollOffset > 0)
                iOffset = -m_ScrollOffset;

			int iStart=m_ScrollOffset;
			int iEnd=m_ScrollOffset+iOffset;
			if(iEnd<0)
				iEnd=0;
			if(m_Animate)
			{
				DateTime start=DateTime.Now;
				for(int i=iStart;i>iEnd;i--)
				{
					this.ScrollOffset=i;
					if(((TimeSpan)DateTime.Now.Subtract(start)).TotalMilliseconds >200)
						break;
				}
			}
			this.ScrollOffset=iEnd;
		}
Пример #12
0
 private void TabHeThong_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     DongTab();
 }
Пример #13
0
        private void CloseSelectedTab()
        {
            if (TabItemClose != null)
            {
                TabStripActionEventArgs action = new TabStripActionEventArgs();
                TabItemClose(this, action);
                if (action.Cancel)
                    return;
            }

            if (this.SelectedTab == null)
                return;

            if (m_MdiTabbedDocuments && this.SelectedTab != null && this.SelectedTab.AttachedControl is Form)
                ((Form)this.SelectedTab.AttachedControl).Close();
            else if (this.SelectedTab != null && this.SelectedTab.AttachedItem != null)
            {
                if (this.SelectedTab.AttachedItem is DockContainerItem)
                {
                    Bar bar = this.SelectedTab.AttachedItem.ContainerControl as Bar;
                    if (bar != null)
                        bar.CloseDockTab((DockContainerItem)this.SelectedTab.AttachedItem, eEventSource.Mouse);
                    else
                        this.SelectedTab.AttachedItem.Visible = false;
                }
            }
        }
Пример #14
0
 private void tabs_TabItemClose(object sender, TabStripActionEventArgs e)
 {
     ((DevComponents.DotNetBar.TabControl)sender).SelectedTab.AttachedControl.Controls[0].Dispose();
 }
Пример #15
0
 private void tabStrip1_TabItemClose(object sender, TabStripActionEventArgs e)
 {
     if (tabStrip1.SelectedTab != null)
     {
         RemoveTab(tabStrip1.SelectedTab);
         // The actual cancel is performed in RemoveTab(), so we need to
         // cancel this removal, otherwise unexpected behaviour occurs.
         e.Cancel = true;
     }
 }
Пример #16
0
 private void TabStripTabItemClose(object sender, TabStripActionEventArgs e)
 {
     TabItem ti = sender as TabItem;
     if (ti != null)
     {
         DockContainerItem di = ti.AttachedItem as DockContainerItem;
         if (di != null)
             CloseDockTab(di, eEventSource.Mouse);
     }
 }
Пример #17
0
 private void tabContent_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     tabContent.Tabs.Remove(tabContent.SelectedTab);
 }
Пример #18
0
		public void MdiFormRemoved(object sender, ControlEventArgs e)
		{
			Form form=e.Control as Form;
			if(form==null)
			{
				if(TabItemClose!=null)
				{
					TabStripActionEventArgs action=new TabStripActionEventArgs();
					TabItemClose(this,action);
				}
				RefreshMdiTabItems();
				return;
			}
			foreach(TabItem item in m_Tabs)
			{
				if(item.AttachedControl==form)
				{
					if(TabItemClose!=null)
					{
						TabStripActionEventArgs action=new TabStripActionEventArgs();
						TabItemClose(item,action);
					}
					m_Tabs.Remove(item);
                    item.AttachedControl = null;
                    item.Dispose();
					form.TextChanged-=new EventHandler(this.FormTextChanged);
					form.VisibleChanged-=new EventHandler(this.FormVisibleChanged);
					this.Invalidate();
					break;
				}
			}
			if(m_MdiAutoHide && m_MdiForm!=null)
			{
				if(m_MdiForm.MdiChildren.Length==0 && !this.IsDesignMode)
					this.Visible=false;
			}
		}
Пример #19
0
 private void tabControl1_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e)
 {
     CloseThis();
 }
Пример #20
0
        private void tabv_TabItemClose(object sender, TabStripActionEventArgs e)
        {
            tabitemReturn = true;
            if (!Gib.saved[(int) Gib.nowmmap.Tag])
            {
                DialogResult tempResult = MessageBoxEx.Show(this, "你对此思维导读所做的更改尚未保存,是否保存?", "提示",
                    MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);

                if (tempResult == DialogResult.Yes)
                {
                    savefile_Click(null, null);
                    if (!savefileReturn)
                    {
                        try
                        {
                            e.Cancel = true;
                        }
                        catch
                        {
                        }

                        savefileReturn = false;
                    }
                }
                else if (tempResult == DialogResult.Cancel)
                {
                    try
                    {
                        e.Cancel = true;
                    }
                    catch
                    {
                    }

                    tabitemReturn = false;
                }
            }
            else
                savefile_Click(null, null);
        }
Пример #21
0
		protected virtual void InvokeNavigateBack(TabStripActionEventArgs e)
		{
			if(NavigateBack!=null)
				NavigateBack(this,e);
		}
Пример #22
0
		private void tabStrip1_NavigateForward(object sender, TabStripActionEventArgs e)
		{
			InvokeNavigateForward(e);
		}
Пример #23
0
 private void tabControl_TabItemClose(object sender, TabStripActionEventArgs e)
 {
     tabControl.Tabs.Remove(tabControl.SelectedTab);
 }
Пример #24
0
        private void tabCalendar_TabItemClose(object sender, TabStripActionEventArgs e)
        {
            e.Cancel = true;

            DevComponents.DotNetBar.TabControl vTabControl = sender as DevComponents.DotNetBar.TabControl;

            if (vTabControl != null)
            {
                DecCalendar Calendar = vTabControl.SelectedPanel.Tag as DecCalendar;
                Calendar.InitialUI();
                vTabControl.SelectedTab.Text = string.Empty;
                vTabControl.SelectedTab.Visible = false;
            }
        }