public NavigateBarCollapsibleText(NavigateBar tNavigateBar) { this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); navigateBar = tNavigateBar; this.Cursor = Cursors.Hand; this.TabStop = true; captionBand = new NavigateBarCaption(navigateBar); captionBand.CollapseMode = false; captionBand.Cursor = Cursors.Default; captionBand.CollapseButton.ToolTipText = Properties.Resources.TEXT_COLLAPSE_BUTTON_EXPAND; this.Controls.Add(captionBand); }
void InitOutlookStyleNavigateBar() { oldWidth = DEFAULT_WIDTH; // Collection navigateBarButtons = new NavigateBarButtonCollection(this); navigateBarButtons.OnButtonAdded += new NavigateBarButtonCollection.OnButtonEventHandler(NavigateBarButtonCollection_OnButtonAdded); navigateBarButtons.OnButtonRemoved += new NavigateBarButtonCollection.OnButtonEventHandler(NavigateBarButtonCollection_OnButtonRemoved); // Control this.BackColor = SystemColors.ControlLightLight; this.MinimumSize = new Size(NavigateBar.OVER_FLOW_BUTTON_WIDTH, 100); this.Disposed += new EventHandler(NavigateBar_Disposed); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.ResizeRedraw, true); this.UpdateStyles(); #region OverFlowPanel overFlowPanel = new NavigateBarOverFlowPanel(this); overFlowPanel.Dock = DockStyle.Bottom; overFlowPanel.Height = this.OverFlowPanelHeight; overFlowPanel.NavigateBar = this; #endregion #region CollapsibleText // If show collaplible screen display button caption on this control collapsibleText = new NavigateBarCollapsibleText(this); collapsibleText.Invalidate(); collapsibleText.MouseClick += delegate(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (collapsibleScreen.IsShowWindow) this.HideCollapseScreen(); else this.ShowOverScreen(); } }; #endregion #region Collapsibile Screen collapsibleScreen = new NavigateBarCollapsibleScreen(this); collapsibleScreen.Visible = false; collapsibleScreen.ControlBox = false; collapsibleScreen.FormBorderStyle = FormBorderStyle.None; collapsibleScreen.Width = COLLAPSIBLE_SCREEN_WIDTH; collapsibleScreen.ShowInTaskbar = false; collapsibleScreen.Activated += new EventHandler(collapsibleScreen_Activated); collapsibleScreen.Deactivate += new EventHandler(collapsibleScreen_Deactivate); collapsibleScreen.IsShowWindow = false; // MessageFilter collapsibleScreenMessageFilter = new NavigateBarCollapsibleScreenMessageFilter(); collapsibleScreenMessageFilter.OnNonCollapsibleScreenAreaFocused += new EventHandler(CollapsibleScreenMessageFilter_OnNonCollapsibleScreenAreaFocused); #endregion #region Caption navigateBarCaption = new NavigateBarCaption(this); navigateBarCaption.Dock = DockStyle.Top; navigateBarCaption.CollapseButton.ToolTipText = Properties.Resources.TEXT_COLLAPSE_BUTTON_COLLAPSE; navigateBarCaption.VisibleChanged += new EventHandler(NavigateBarCaption_VisibleChanged); navigateBarCaption.CaptionFont =new Font("Tahoma", 14, FontStyle.Bold); navigateBarCaptionDesc = new NavigateBarCaptionDescription(); navigateBarCaptionDesc.NavigateBar = this; navigateBarCaptionDesc.Dock = DockStyle.Top; navigateBarCaptionDesc.VisibleChanged += new EventHandler(NavigateBarCaption_VisibleChanged); captionPanel = new Panel(); captionPanel.Height = navigateBarCaption.Height + navigateBarCaptionDesc.Height; captionPanel.Dock = DockStyle.Top; captionPanel.Controls.Add(navigateBarCaptionDesc); captionPanel.Controls.Add(navigateBarCaption); #endregion #region Splitter splitter = new NavigateBarSplitter(this); splitter.Height = 8; splitter.Width = this.Width; splitter.Anchor = AnchorStyles.Left | AnchorStyles.Right; splitter.MouseDown += new MouseEventHandler(Splitter_MouseDown); splitter.MouseMove += new MouseEventHandler(Splitter_MouseMove); splitter.MouseUp += new MouseEventHandler(Splitter_MouseUp); #endregion // Display for related control relatedControlContainer = new NavigateBarControlPanel(); relatedControlContainer.NavigateBar = this; //relatedControlContainer.Dock = DockStyle.Fill; relatedControlEmpty = new NavigateBarControlPanel(); relatedControlEmpty.NavigateBar = this; relatedControlEmpty.Dock = DockStyle.Fill; // Renderer renderer = new NavigateBarRenderer(this.NavigateBarColorTable); // Settings class settings = new NavigateBarSettings(this); // Add controls in NavigateBar Controls.Add(captionPanel); Controls.Add(relatedControlContainer); Controls.Add(splitter); Controls.Add(overFlowPanel); // Add Message Filter Application.AddMessageFilter(collapsibleScreenMessageFilter); }
public NavigateBarCollapsibleScreen(NavigateBar tNavigateBar) { navigateBar = tNavigateBar; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.ResizeRedraw, true); // Get positon on desktop screen Point p = new Point(navigateBar.Location.X + Width, navigateBar.Location.Y); this.DesktopLocation = this.PointToScreen(p); // Caption info caption = new NavigateBarCaption(navigateBar); caption.Height = 20; caption.CollapseButton.Visible = false; // Controls.Add(caption); Controls.Add(panelControl); // }