private TdhTabCtl _owner = null; // 1.0.001 #endregion #region Class Constructor (and Dispose) // // public TdhTabPageCollection(TdhTabCtl owner) : base((System.Windows.Forms.TabControl)owner) // // protected void Dispose( bool disposing ) // public TdhTabPageCollection(TdhTabCtl owner) : base((System.Windows.Forms.TabControl)owner) // 1.0.001 { // 1.0.001 Initialize_gblRunModeIs(); // Set [gblRunModeIs_DebugMode] and [gblRunModeIs_DesignMode] // 1.0.000 /// // 1.0.001 /// Required for Windows.Forms Class Composition Designer support // 1.0.001 /// // 1.0.001 InitializeComponent(); // 1.0.001 // // 1.0.001 // TODO: Add any constructor code after InitializeComponent call // 1.0.001 // // 1.0.001 //_owner = owner; // 1.0.001 if (!gblRunModeIs_DesignMode) // 1.0.001 { // 1.0.001 _owner = owner; // 1.0.001 } // 1.0.001 } // 1.0.001
} // 1.0.001 internal static void TabRect_DrawButtons( // 1.0.001 TdhTabCtl theTabCtl, // 1.0.001 System.Drawing.Point ptMouse, // 1.0.001 System.Drawing.Graphics gfx, // 1.0.001 System.Drawing.RectangleF tabRectDraw, int tabRectIdx, // 1.0.001 bool asActiveExplicit, bool asInactiveExplicit // 1.0.003 ) // 1.0.001 { // 1.0.001 lock (mutex_TabRect_DrawButtons) // Just-in-case // 1.0.001 { // 1.0.001 #region Draw the "Close pseudo-Button" Rectangle? if (theTabCtl.CanDrawCloseButton(tabRectIdx) ) // 1.0.001 { // 1.0.001 System.Drawing.RectangleF tabRectClose = theTabCtl.TabRect_CloseButton(tabRectDraw); // 1.0.001 #region Draw the "Close pseudo-Button" Rectangle as "active?" if( (asActiveExplicit // Explicitly draw as "active?" // 1.0.003 || (!asInactiveExplicit // 1.0.003 && tabRectClose.Contains(ptMouse) ) // Is mouse location within the "Close pseudo-Button" Rectangle? // 1.0.001 ) // 1.0.001 && (theTabCtl.TabCount > 1) // 1.0.003 && theTabCtl.TabsAllowClose // 1.0.005 && theTabCtl.TdhTabPages[tabRectIdx].TabAllowClose // 1.0.010 ) // 1.0.001 { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 false, // 1.0.001 tabRectClose, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.Color.FromArgb(255, 252, 193, 183), // 1.0.001 System.Drawing.Color.FromArgb(255, 252, 193, 183), // 1.0.001 System.Drawing.Color.FromArgb(255, 210, 35, 2), // 1.0.001 System.Drawing.Color.FromArgb(255, 210, 35, 2) // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region No; Draw the "Close pseudo-Button" Rectangle as "disabled?" if( !asInactiveExplicit // 1.0.003 && (asActiveExplicit // Explicitly draw as "active?" // 1.0.003 || tabRectClose.Contains(ptMouse) // Is mouse location within the "Close pseudo-Button" Rectangle? // 1.0.001 || (tabRectIdx == theTabCtl.SelectedIndex) ) // or within the TabRect? // 1.0.001 &&( (theTabCtl.TabCount <= 1) // Cannot close this TabPage // 1.0.003 || !theTabCtl.TabsAllowClose // 1.0.005 || !theTabCtl.TdhTabPages[tabRectIdx].TabAllowClose // 1.0.010 ) // 1.0.003 ) // 1.0.001 { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 false, // 1.0.001 tabRectClose, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.Color.FromArgb(255, 197, 98, 79), // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ControlDarkDark, // 1.0.001 System.Drawing.SystemColors.ControlDark // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region No; Draw the "Close pseudo-Button" Rectangle as "semi-active?" if( (!asInactiveExplicit // 1.0.003 && (tabRectIdx == theTabCtl.SelectedIndex) ) // 1.0.001 && theTabCtl.TdhTabPages[tabRectIdx].TabAllowClose // 1.0.010 ) // 1.0.001 { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 false, // 1.0.001 tabRectClose, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.Color.FromArgb(255, 231, 164, 152), // 1.0.001 System.Drawing.Color.FromArgb(255, 231, 164, 152), // 1.0.001 System.Drawing.Color.FromArgb(255, 197, 98, 79), // 1.0.001 System.Drawing.Color.FromArgb(255, 197, 98, 79) // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region No; Draw the "Close pseudo-Button" Rectangle as "inactive?" { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 false, // 1.0.001 tabRectClose, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion } // 1.0.001 #endregion #region Draw the "Menu pseudo-Button" Rectangle? if (theTabCtl.CanDrawMenuButton(tabRectIdx) ) // 1.0.001 { // 1.0.001 System.Drawing.RectangleF tabRectMenu = theTabCtl.TabRect_MenuButton(tabRectDraw, tabRectIdx); // 1.0.001 #region Draw the "Menu pseudo-Button" Rectangle as "active?" if (asActiveExplicit // Explicitly draw as "active?" // 1.0.003 || (!asInactiveExplicit // 1.0.003 && tabRectMenu.Contains(ptMouse) ) // Is mouse location within the "Close pseudo-Button" Rectangle? // 1.0.001 ) // 1.0.001 { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 true, // 1.0.001 tabRectMenu, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 255), // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 255), // 1.0.001 System.Drawing.Color.FromArgb(255, 44, 157, 250), // 1.0.001 System.Drawing.Color.FromArgb(255, 44, 157, 250) // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region No; Draw the "Menu pseudo-Button" Rectangle as "semi-active?" if (!asInactiveExplicit // 1.0.003 && (tabRectIdx == theTabCtl.SelectedIndex) ) // 1.0.001 { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 true, // 1.0.001 tabRectMenu, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 243), // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 243), // 1.0.001 System.Drawing.Color.FromArgb(255, 44, 137, 191), // 1.0.001 System.Drawing.Color.FromArgb(255, 44, 137, 191) // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region No; Draw the "Menu pseudo-Button" Rectangle as "inactive?" { // 1.0.001 TabRect_DrawButton( // 1.0.001 gfx, // 1.0.001 true, // 1.0.001 tabRectMenu, // 1.0.001 new System.Drawing.Color[] // 1.0.001 { // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder, // 1.0.001 System.Drawing.SystemColors.ActiveBorder // 1.0.001 } // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion } // 1.0.001 #endregion } // 1.0.001 } // 1.0.001
private static System.Object mutex_TabRect_DrawButtons = new System.Object[0]; // 1.0.001 internal static void TabRect_DrawButtons( // 1.0.001 TdhTabCtl theTabCtl, // 1.0.001 System.Drawing.Point ptMouse, // 1.0.001 System.Drawing.Graphics gfx, // 1.0.001 System.Drawing.RectangleF tabRectDraw, int tabRectIdx // 1.0.001 ) // 1.0.001 { // 1.0.001 TabRect_DrawButtons( // 1.0.003 theTabCtl, // 1.0.003 ptMouse, // 1.0.003 gfx, // 1.0.003 tabRectDraw, tabRectIdx, // 1.0.003 false, false // 1.0.003 ); // 1.0.003 } // 1.0.001
private static System.Object mutex_TabRect_DrawTabRect = new System.Object[0]; // 1.0.003 internal static void TabRect_DrawTabRect( // 1.0.003 TdhTabCtl theTabCtl, // 1.0.003 System.Drawing.Point ptMouse, // 1.0.003 System.Windows.Forms.TabPage theTabPage, int idxTabPage, bool asActive, // 1.0.010 System.Drawing.Graphics gfx, System.Drawing.RectangleF tabRectDraw // 1.0.003 ) // 1.0.003 { // 1.0.003 lock (mutex_TabRect_DrawTabRect) // Just-in-case // 1.0.003 { // 1.0.003 #region Draw the TabRect Background and Buttons System.Drawing.Drawing2D.GraphicsPath _Path = new System.Drawing.Drawing2D.GraphicsPath(); _Path.AddRectangle(tabRectDraw); using ( System.Drawing.Drawing2D.LinearGradientBrush _Brush = new System.Drawing.Drawing2D.LinearGradientBrush( tabRectDraw, System.Drawing.SystemColors.Control, System.Drawing.SystemColors.ControlLight, System.Drawing.Drawing2D.LinearGradientMode.Vertical) ) { if (asActive) // Is this the active TabPage? // 1.0.003 { // 1.0.003 #region Draw the TabRect background (active TabPage) System.Drawing.Drawing2D.ColorBlend _ColorBlend = new System.Drawing.Drawing2D.ColorBlend(3); _ColorBlend.Colors = new System.Drawing.Color[] { //System.Drawing.SystemColors.ControlLightLight, //System.Drawing.Color.FromArgb(255, System.Drawing.SystemColors.Control), //System.Drawing.SystemColors.ControlLight, //System.Drawing.SystemColors.Control // System.Drawing.SystemColors.ControlLightLight, // 1.0.001 // //System.Drawing.Color.FromArgb(255, System.Drawing.SystemColors.ControlLight),// 1.0.001 // System.Drawing.SystemColors.ControlLight, // 1.0.001 // System.Drawing.SystemColors.ControlDark, // 1.0.001 // System.Drawing.SystemColors.ControlLightLight // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 243), // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 243), // 1.0.001 System.Drawing.Color.FromArgb(255, 170, 213, 243), // 1.0.001 //System.Drawing.Color.FromArgb(255, 44, 137, 191), // 1.0.001 System.Drawing.Color.FromArgb(255, 44, 137, 191) // 1.0.001 }; _ColorBlend.Positions = new float[] { 0f, .4f, 0.5f, 1f }; _Brush.InterpolationColors = _ColorBlend; gfx.FillPath(_Brush, _Path); // 1.0.003 using (Pen pen = new Pen(SystemColors.ActiveBorder)) { gfx.DrawPath(pen, _Path); // 1.0.003 } #endregion } // 1.0.003 else // 1.0.003 { // 1.0.003 #region Draw the TabRect background (inactive TabPage) ColorBlend _ColorBlend = new ColorBlend(3); _ColorBlend.Colors = new System.Drawing.Color[] { //System.Drawing.SystemColors.ControlLightLight, //System.Drawing.Color.FromArgb(255, System.Drawing.SystemColors.ControlLight), //System.Drawing.SystemColors.ControlDark, //System.Drawing.SystemColors.ControlLightLight // System.Drawing.SystemColors.ControlDarkDark, // 1.0.001 // System.Drawing.SystemColors.ControlLightLight, // 1.0.001 // System.Drawing.SystemColors.ControlLightLight, // 1.0.001 // System.Drawing.SystemColors.ControlLight // 1.0.001 System.Drawing.SystemColors.ControlLightLight, // 1.0.001 System.Drawing.Color.FromArgb(255, System.Drawing.SystemColors.ControlLight), // 1.0.001 //System.Drawing.SystemColors.ControlLightLight, // 1.0.001 System.Drawing.SystemColors.ControlLight, // 1.0.001 System.Drawing.SystemColors.ControlDark // 1.0.001 }; _ColorBlend.Positions = new float[] { 0f, .4f, 0.5f, 1f }; _Brush.InterpolationColors = _ColorBlend; gfx.FillPath(_Brush, _Path); // 1.0.003 using (System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.SystemColors.ActiveBorder)) { gfx.DrawPath(pen, _Path); // 1.0.003 } #endregion } // 1.0.003 #region Draw Buttons this TabRect if( (theTabPage.GetType() == typeof(TdhTabPage)) // 1.0.010 || theTabPage.GetType().IsSubclassOf(typeof(TdhTabPage)) // 1.0.010 ) // 1.0.010 { // 1.0.010 TabRect_DrawButtons( // 1.0.001 theTabCtl, ptMouse, // 1.0.003 gfx, // 1.0.003 tabRectDraw, idxTabPage, asActive, !asActive // 1.0.003 ); // 1.0.001 } // 1.0.010 #endregion } _Path.Dispose(); #endregion #region Draw [theTabPage.Text] on the TabRect int textOffset = 0; // 1.0.001 if (theTabCtl.Font.Size <= 8.25f) // Size: 8 // 1.0.003 { // 1.0.001 textOffset = 5; // 1.0.001 } // 1.0.001 else // 1.0.001 if (theTabCtl.Font.Size <= 9f) // Size: 9 // 1.0.003 { // 1.0.001 textOffset = 4; // 1.0.001 } // 1.0.001 else // 1.0.001 if (theTabCtl.Font.Size <= 9.75f) // Size: 10 // 1.0.003 { // 1.0.001 textOffset = 3; // 1.0.001 } // 1.0.001 else // 1.0.001 if (theTabCtl.Font.Size < 11.25f) // Size: 11 // 1.0.003 { // 1.0.001 textOffset = 2; // 1.0.001 } // 1.0.001 else // 1.0.001 if (theTabCtl.Font.Size < 12f) // Size: 12 // 1.0.003 { // 1.0.001 textOffset = 1; // 1.0.001 } // 1.0.001 System.Drawing.RectangleF textRect = new System.Drawing.RectangleF( // 1.0.001 tabRectDraw.X, // 1.0.001 tabRectDraw.Y + textOffset, // 1.0.001 tabRectDraw.Width, // 1.0.001 tabRectDraw.Height - textOffset); // 1.0.001 string str = " "+ theTabPage.Text.Trim(); // 1.0.010 System.Drawing.StringFormat stringFormat = new System.Drawing.StringFormat(); stringFormat.Alignment = System.Drawing.StringAlignment.Near; // 1.0.001 gfx.DrawString( // 1.0.003 str, theTabCtl.Font, // 1.0.003 new System.Drawing.SolidBrush(theTabPage.ForeColor), // 1.0.010 textRect, // 1.0.001 stringFormat); #endregion } // 1.0.003 } // 1.0.003
private TdhTabCtl _owner = null; // 1.0.002 #endregion #region Class Constructor (and Dispose) // public TdhTabPageControls(TDHControls.TdhTabCtl owner) // : base((System.Windows.Forms.Control)owner) // // protected void Dispose( bool disposing ) // public TdhTabPageControls(XmlParsersAndUi.TdhTabCtl owner) // 1.0.002 : base((System.Windows.Forms.Control)owner) // 1.0.002 { // 1.0.002 Initialize_gblRunModeIs(); // Set [gblRunModeIs_DebugMode] and [gblRunModeIs_DesignMode] // 1.0.000 _owner = owner; // 1.0.002 } // 1.0.002
private System.Text.RegularExpressions.Regex _regexFilter = null; // 1.0.003 #endregion #region (Form) TdhTabReorder class constructor (and Dispose), etc // public TdhTabReorder( // TdhTabCtl theTabCtl, int activeTabPage_Idx, // System.Drawing.Point ptShow, int height, int width // ) // // protected override void Dispose( bool disposing ) // // protected override void OnActivated(System.EventArgs e) // public TdhTabReorder( // 1.0.003 TdhTabCtl theTabCtl, int activeTabPage_Idx, // 1.0.003 System.Drawing.Point ptShow, int height, int width // 1.0.003 ) // 1.0.003 { // 1.0.003 // // 1.0.003 // Required for Windows Form Designer support // 1.0.003 // // 1.0.003 InitializeComponent(); // 1.0.003 // // 1.0.003 // TODO: Add any constructor code after InitializeComponent call // 1.0.003 // // 1.0.003 this.DialogResult = System.Windows.Forms.DialogResult.None; // 1.0.003 //this.Location = this.PointToScreen(ptShow); // 1.0.003 this.Location = ptShow; // 1.0.003 this.ClientSize = new System.Drawing.Size(348, 58); // 1.0.004 if (height >= 60) // 1.0.003 { // 1.0.003 this.Height = height; // 1.0.003 } // 1.0.003 if (width >= 350) // 1.0.004 { // 1.0.003 this.Width = width; // 1.0.003 } // 1.0.003 this._idxPbxActive = activeTabPage_Idx; // 1.0.003 this._theTabCtl = theTabCtl; // 1.0.003 trackBarMoveTo_SetProperties(this._theTabCtl.TabCount); // 1.0.003 pbxWork_X_Build(activeTabPage_Idx); // 1.0.003 trackBarMoveTo_SetValue(this._idxPbxActive + 1); // 1.0.003 this.trackBarMoveTo.Focus(); // 1.0.003 } // 1.0.003