private void OnBandChanged( object sender, OutlookBarBandCollection.OutlookBarBandEventArgs e ) { Invalidate(); }
private void OnBandAdded( object sender, OutlookBarBandCollection.OutlookBarBandEventArgs e ) { if( currentBandIndex < 0 ) { currentBandIndex = 0; } e.Band.Changed += new EventHandler( OnOutlookBarBandChanged ); }
private void OnBandRemoved( object sender, OutlookBarBandCollection.OutlookBarBandEventArgs e ) { int index = bands.IndexOf( e.Band ); e.Band.Changed -= new EventHandler( OnOutlookBarBandChanged ); if( index == CurrentBand ) { if( index > 0 && bands.Count != 0 ) { CurrentBand = index-1; } } }
public OutlookBar() { // Construct band collection bands = new OutlookBarBandCollection(); bands.Changed += new OutlookBarBandCollection.OutlookBarBandEventHandler( OnBandChanged ); bands.OnItemAdded += new OutlookBarBandCollection.OutlookBarBandEventHandler( OnBandAdded ); bands.OnItemRemoved += new OutlookBarBandCollection.OutlookBarBandEventHandler( OnBandRemoved ); Dock = DockStyle.Left; // We are going to do all of the painting so better setup the control // to use double buffering SetStyle( ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | //ControlStyles.Opaque | ControlStyles.UserPaint | ControlStyles.Selectable | ControlStyles.DoubleBuffer, true ); Font = SystemInformation.MenuFont; CreateContextMenu(); // Setup timer highlightTimer.Tick += new EventHandler( OnHighlightHeader ); highlightTimer.Interval = 100; // Load drag cursor try { Assembly myAssembly = Assembly.GetAssembly(Type.GetType("UtilityLibrary.WinControls.OutlookBar")); Stream cursorStream = myAssembly.GetManifestResourceStream("UtilityLibrary.Resources.DragCursor.cur"); dragCursor = new Cursor( cursorStream ); } catch { dragCursor = Cursors.Hand; } // don't display it until we need to textBox.Visible = false; // Hook up notification for the Enter and LostFocus events textBox.KeyUp += new KeyEventHandler(TextBoxKeyDown); textBox.LostFocus += new EventHandler(TextBoxLostFocus); }