Click here to Skip to main content
15,892,737 members
Articles / Desktop Programming / Windows Forms

A Serious Outlook Style Navigation Pane Control

Rate me:
Please Sign up or sign in to vote.
4.94/5 (135 votes)
15 Nov 2010CC (ASA 2.5)6 min read 1.3M   72.1K   518  
A quality rendered Outlook style navigation pane control
using System.ComponentModel;
using System.Windows.Forms.Design;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Drawing;

namespace Guifreaks.NavigationBar.Design
{
   internal class NavigationBarDesigner : ParentControlDesigner
   {
      #region Fields

      NavigationBar m_designingControl;
      ISelectionService selectionService;

      #endregion

      #region Constructor
      #endregion

      #region Static

      public static int LoWord(int dwValue)
      {
         return dwValue & 0xFFFF;
      }

      public static int HiWord(int dwValue)
      {
         return (dwValue >> 16) & 0xFFFF;
      }

      #endregion

      #region Properties
      #endregion

      #region Methods

      private void InitializeServices()
      {
         selectionService = (ISelectionService)GetService(typeof(ISelectionService));
         if (selectionService != null)
         {
            selectionService.SelectionChanged += new System.EventHandler(selectionService_SelectionChanged);
         }
      }

      #endregion

      #region Overrides

      public override void Initialize(IComponent component)
      {
         base.Initialize(component);
         m_designingControl = component as NavigationBar;
         InitializeServices();
      }

      #endregion

      #region Event Handling

      void selectionService_SelectionChanged(object sender, System.EventArgs e)
      {
         if (selectionService.PrimarySelection is NavigationBarBandButton)
         {
            m_designingControl.SetActiveBand(
               ((NavigationBarBandButton)selectionService.PrimarySelection).BarBand);
         }
      }

      #endregion
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Creative Commons Attribution-ShareAlike 2.5 License


Written By
Architect
Netherlands Netherlands
I design software for a ERP software vendor in the Netherlands.

For more information, the latest version installer etc goto guifreaks.net

Comments and Discussions