Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Outlook 2003 Style Navigation Pane

4.82/5 (100 votes)
8 Nov 2007CPOL5 min read 31   20.2K  
Outlook 2003 Style Navigation Pane (Almost 2007 Style)
Screenshot - Outlook_Navigation_Pane.JPG

Introduction

This control has been developed according to Microsoft Office 2003 controls. Most of the properties are included. However, there is no support yet for the "Design Time" property. This control contains five sub-controls:

  1. Title: This section is at the top of the control. The property describes the control and is also the visible control indicated on the button.
  2. Title explanation: This section is under the title info, which should hold long info rather than the title info. If the title was not defined, this control uses the title. Visible control is indicated on the button.
  3. Related control: This control shows when the button is selected and is not moveable. This property has to indicate on the control when the control is added. Furthermore, this control is shown on the button. If this control was not added on the button, the control will shown only a panel.
  4. Buttons: This object is dependent on the control. Almost all properties are contained in this control.
  5. Carrying panel: The buttons can add onto the carrying panel. If this situation is not possible, the buttons will be added on the menu.

NavigateBar Control

This navigate bar must be used in a carrier panel. It will be deployed on the included control. All of the controls specified above come up within this control. Briefly:

Properties

  • NavigateBarButtons: Collection that carries NavigateBarButton controls. New button can be added here.
  • NavigateBarButtonHeight: Every new button uses this value for height info.
  • NavigateBarDisplayedButtonCount: Maximum number of buttons can be added on the panel. Default is all buttons if it is not set.
  • SelectedButton: Holds selected or picked-out button info.
  • NavigateBarColorTable: Contains color settings for Panel and Sub-controls. System defaults valid when undefined. It is possible to customize.
  • SaveAndRestoreSettings: Each application saving a different location. For save and restore, you must set NavigateBarButton.KEY values. Default settings result in file saves in XML file format in the %APPDATA%\AppExeFileName folder. You can set any disk location and file name.
  • IsCollapsible: Is it a collapsible pane? Default is true.
  • IsShowCollapseButton: Show collapse button on the caption band.
  • IsCollapsedMode: Get collapsible mode state.
  • IsShowCollapsibleScreen: If pane width is smaller than minimum size, is it displayed as a collapsible screen?
  • IsUseRTLforButtons: Use RightToLeft for buttons.
  • IsUseRTLforMenus: Use RightToLeft for context menus.
  • IsCollapsibleScreenShowNow: Is it displayed as a collapsible screen?
  • IsCollapseScreenShowOnButtonSelect: Is it shown as a collapsible screen when button is clicked?
  • CollapsibleScreenWidth: Collapsible screen width.
  • CollapsibleWidth: Required panel width for collapsible mode.
  • RelatedControl: If Button.RelatedControl is empty, then display this control.
  • OverFlowPanelHeight: Get or Set overflow panel height.
  • DisplayedButtonCount: Get or Set displayed button count in panel.
  • AlwaysUseSystemColors: Get or Set; if always use system colors, set as true.

Methods

  • ChangeCollapseMode: If collapsible, then changes the collapse mode.
  • ChangeButtonPosition: Sets new position in panel and collection for button.
  • ShowCollapseScreen: If collapsed mode, then shows collapse screen.
  • HideCollapseScreen: If collapsed mode, then hides collapse screen.
  • RunMenuOptionsDialog: Open Navigatebar "Menu Option" form.

Events

  • OnNavigateBarButtonHeightChanged: Triggers when button height is changed. Displays old and new values.
  • OnNavigateBarButtonAdded: Triggers when new button is added. Displays new button's info.
  • OnNavigateBarButtonRemoved: Triggers when existing button is removed. Displays removed button's info.
  • OnNavigateBarButtonSelecting: Triggers when a button is selecting.
  • OnNavigateBarButtonSelected: Triggers when a button is selected. Displays selected button's info.
  • OnNavigateBarDisplayedButtonCountChanged: Triggers when displayed button count is changed.
  • OnNavigateBarCollapseModeChanged: Triggers when collapse mode is changed.
  • OnNavigateBarColorChanged: Triggers when the color table is changed.

NavigateBarButton Control

This contains the button info that is added into the panel. The button is the main object of control and almost all properties are saved on it. Briefly:

Properties

  • Caption: This is the text info on the button and also its panel title. It will also be used for ToolTipText if ToolTipText has not been set.
  • CaptionDescription: Description of the panel title.
  • RelatedControl: The control that displays on the panel when the button is selected. Panel with notification message will display when it is undefined.
  • Key: Each one is a unique value in the collection. This value is used for save and restore.
  • Image: Holds picture info. 24x24 size is recommended. This picture will be used when it is disabled. It is an alternative to use. When this picture does not exist, one default picture will be added in OverFlowPanel.
  • MouseOverImage: Picture info when mouse points on it. Image info will be used when it is undefined.
  • SelectedImage: Picture info when it is selected. Image info will be used when it is undefined.
  • IsSelected: Saves if button is selected or not.
  • IsDisplayed: Saves if button display is in the panel or not.
  • IsAlwaysDisplayed: Don't change the IsDisplayed state. Always shows NavigateBarButton.
  • IsShowCaption: Saves display of title on panel or not when the button selected.
  • IsShowCaptionDescription: Sets display of panel description when the button is selected.
  • Font: Button's font info.
  • ForeColor: Button's font color info.
  • ToolTipText: The text info that is shown when button and overflow panel are not big enough.
  • DefaultButtonHeight: Button's default height info. Defined as static.
  • MinimumButtonHeight: Minimum height info that the button can have. Defined as static.
  • CollapsedScreenWidth: Collapse screen width for this button.
  • IsShowCollapseScreenCaption: Show caption band on collapse screen.

Methods

  • PerformClick: Run button's selected event manually.

Events

  • OnNavigateBarButtonSelected: Triggers when a button is selected. First, it kicks off here and then kicks off the part in the main NavigationBar.
  • OnNavigateBarButtonCaptionChanged: Triggers when the button title info is changed. Displays old and new values.
  • OnNavigateBarButtonCaptionDescriptionChanged: Triggers when the button title description info is changed. Displays old and new values.
  • OnNavigateBarButtonDisplayChanged: Triggers when the button's display settings info in the panel is changed. Displays old and new values.

Using the Code

Some simple navigation pane code:

C#
// Create a Navigation Pane
NavigateBar navigationPane = new NavigateBar();

// Create a Navigation Pane Button
NavigateBarButton nvbMail = new NavigateBarButton();
nvbMail.Caption = "Mail";
nvbMail.CaptionDescription = "Mail Folders";
nvbMail.Image = Properties.Resources.Mail24;
nvbMail.Key = "MAIL";
nvbMail.RelatedControl = new MyCustomControl();
nvbMail.CollapsedScreenWidth = 160;

// Add Buttons
navigationPane.NavigateBarButtons.Add(nvbMail);
navigationPane.NavigateBarButtons.Add(new NavigateBarButton("Calendar"));

// Set Optional Properties
navigationPane.NavigateBarDisplayedButtonCount = 3; // Show maximum 3 button
navigationPane.NavigateBarColorTable = NavigateBarColorTable.Office2007Blue;
navigationPane.IsShowCollapsibleScreen = true;

History

  • 11.07.2007: Version 2.6.4
    • Added: If deactivate or change application, close collapse screen.
    • Improved: Collapse screen show method.
    • Fixed: Splitter resize problem.
  • 08.31.2007: Version 2.6.3
    • Improved: Collapse button click.
    • Removed: Unused methods from NavigateBarHelpers.cs.
    • Fixed: If unsave setting, then changing button position.
    • Fixed: Button's right click menu closing, then paint.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)