protected override void OnClosed(EventArgs e) { foreach (var disposable in TabPages.OfType <IDisposable>()) { disposable.Dispose(); } base.OnClosed(e); }
public void RefreshAll(Type refreshType) { foreach (DwarfTabPage page in TabPages.OfType <DwarfTabPage>()) { if (page.Current.GetType() == typeof(HtmlControl) && ((HtmlControl)page.Current).HtmlObject.GetType() == refreshType) { page.Current.Refresh(); } else if (page.Current.GetType() == typeof(ChartControl) && ((ChartControl)page.Current).FocusObject.GetType() == refreshType) { page.Current.Refresh(); } } }
public void RefreshAll(Type refreshType) { foreach (DwarfTabPage page in TabPages.OfType <DwarfTabPage>()) { //if (page.BackHistory.Count > 0) if (page.Current.GetType() == typeof(HTMLControl) && (page.Current as HTMLControl).HTMLObject.GetType() == refreshType) { page.Current.Refresh(); } else if (page.Current.GetType() == typeof(ChartControl) && (page.Current as ChartControl).FocusObject.GetType() == refreshType) { page.Current.Refresh(); } } }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; g.Clear(_backColor); using (Brush parentBackBrush = new SolidBrush(Parent.BackColor)) { Rectangle rectHeader = new Rectangle(0, 0, Width, ItemSize.Height + 2); g.FillRectangle(parentBackBrush, rectHeader); TabPage[] tabs = TabPages.OfType <TabPage>().ToArray(); for (int i = 0; i < tabs.Length; i++) { TabPage tabPage = tabs[i]; Rectangle rect = GetTabRect(i); if (i == 0) { rect = new Rectangle(0, rect.Y, rect.Width + rect.X, rect.Height); } Brush backBrush = SelectedTab == tabPage ? _tabBrushActive : _tabBrushInactive; g.FillRectangle(backBrush, rect); Rectangle rectDivider = new Rectangle(rect.Left + rect.Width - _tabRigthSeparator, rect.Y, _tabRigthSeparator, rect.Height); g.FillRectangle(parentBackBrush, rectDivider); using (Brush brushText = new SolidBrush(ForeColor)) { RectangleF rectText = new RectangleF(rect.Left, rect.Y, rect.Width - _tabRigthSeparator, rect.Height); g.TextRenderingHint = DrawingHelper.ControlRenderingHint; g.DrawString(tabPage.Text, Font, brushText, rectText, _tabHeaderTxtFormat); } } } }