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); } }
/// <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); } } }
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; } } } }
private void TabCtrl_main_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e) { TabCtrl_main.Tabs.Remove(TabCtrl_main.SelectedTab); }
protected virtual void InvokeTabItemClose(TabStripActionEventArgs e) { if(TabItemClose!=null) TabItemClose(this,e); }
/// <summary> /// 关闭绘图 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件</param> private void tabControl1_TabItemClose(object sender, TabStripActionEventArgs e) { documentManager.CheckAndSaveFlowChart(); }
protected virtual void InvokeNavigateForward(TabStripActionEventArgs e) { if(NavigateForward!=null) NavigateForward(this,e); }
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(); } }
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; }
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; }
private void TabHeThong_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e) { DongTab(); }
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; } } }
private void tabs_TabItemClose(object sender, TabStripActionEventArgs e) { ((DevComponents.DotNetBar.TabControl)sender).SelectedTab.AttachedControl.Controls[0].Dispose(); }
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; } }
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); } }
private void tabContent_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e) { tabContent.Tabs.Remove(tabContent.SelectedTab); }
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; } }
private void tabControl1_TabItemClose(object sender, DevComponents.DotNetBar.TabStripActionEventArgs e) { CloseThis(); }
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); }
protected virtual void InvokeNavigateBack(TabStripActionEventArgs e) { if(NavigateBack!=null) NavigateBack(this,e); }
private void tabStrip1_NavigateForward(object sender, TabStripActionEventArgs e) { InvokeNavigateForward(e); }
private void tabControl_TabItemClose(object sender, TabStripActionEventArgs e) { tabControl.Tabs.Remove(tabControl.SelectedTab); }
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; } }