/// <summary> /// Creates new instance of the control. /// </summary> public BubbleBar() { if (!ColorFunctions.ColorsLoaded) { NativeFunctions.RefreshSettings(); NativeFunctions.OnDisplayChange(); ColorFunctions.LoadColors(); } this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.Opaque, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.SetStyle(DisplayHelp.DoubleBufferFlag, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.ContainerControl, false); this.SetStyle(ControlStyles.Selectable, false); m_Tabs = new BubbleBarTabCollection(this); m_ButtonBackAreaStyle.StyleChanged += new EventHandler(ElementStyleChanged); m_BackgroundStyle.StyleChanged += new EventHandler(ElementStyleChanged); m_ContentManager.BlockSpacing = 0; m_ContentManager.ContentVerticalAlignment = eContentVerticalAlignment.Bottom; m_ContentManager.BlockLineAlignment = eContentVerticalAlignment.Bottom; m_ContentManager.ContentOrientation = eContentOrientation.Horizontal; m_TabLayoutManager = new SimpleTabLayoutManager(); m_TabDisplay = new SimpleTabDisplay(); m_TabContentManager = new SerialContentLayoutManager(); //m_Buttons=new BubbleButtonCollection(this); m_BubbleButtonDisplayInfo.BubbleBar = this; // Make sure this is JIT-ed m_Overlay = new BubbleBarOverlay(this); m_Overlay = null; if (!OSFeature.Feature.IsPresent(OSFeature.LayeredWindows)) m_EnableOverlay = false; ApplyButtonAlignment(); // m_SelectedTabColors.BorderColor=Color.Black; // m_MouseOverTabColors.BorderColor=SystemColors.Highlight; }
private void DestroyOverlay() { if (m_Overlay == null) return; OnBubbleEnd(new EventArgs()); m_Overlay.Hide(); m_Overlay.AfterClose(); m_Overlay.Dispose(); m_Overlay = null; // Layout buttons without overlay m_ContentManager.MouseOverIndex = -1; this.LayoutButtons(); if (m_MouseOverButton != null) m_ContentManager.MouseOverIndex = m_MouseOverButton.Parent.Buttons.IndexOf(m_MouseOverButton); this.Invalidate(); }
private void CreateOverlay() { if (m_Overlay == null) { OnBubbleStart(new EventArgs()); } if (m_Overlay != null || this.Parent == null || !m_EnableOverlay || this.DesignMode || !m_AnimationEnabled) return; Rectangle overlayBounds = this.GetOverlayBounds(); m_Overlay = new BubbleBarOverlay(this); m_Overlay.Bounds = overlayBounds; m_Overlay.Visible = false; // Layout buttons for overlay m_ContentManager.MouseOverIndex = -1; this.LayoutButtons(); if (m_MouseOverButton != null) m_ContentManager.MouseOverIndex = m_MouseOverButton.Parent.Buttons.IndexOf(m_MouseOverButton); m_Overlay.CreateControl(); Point p = this.Parent.PointToScreen(m_Overlay.Location); m_Overlay.BeforeShow(); int hwndInsertAfter = NativeFunctions.HWND_NOTOPMOST; if (this.FindForm() != null && this.FindForm().TopMost) hwndInsertAfter = NativeFunctions.HWND_TOPMOST; NativeFunctions.SetWindowPos(m_Overlay.Handle, new IntPtr(hwndInsertAfter), p.X, p.Y, m_Overlay.Width, m_Overlay.Height, NativeFunctions.SWP_SHOWWINDOW | NativeFunctions.SWP_NOACTIVATE); m_Overlay.Visible = true; m_Overlay.UpdateWindow(); this.Refresh(); }