?? outlookbarbandcollection.cs
字號:
using System;
using System.Collections;
using System.Windows.Forms;
using UtilityLibrary.WinControls;
namespace UtilityLibrary.Collections
{
/// <summary>
/// Summary description for OutlookBarBandCollection.
/// </summary>
public class OutlookBarBandCollection : System.Collections.CollectionBase, IEnumerable
{
#region Events
public event EventHandler Changed;
#endregion
#region Class Variables
// Back reference to the parent control
OutlookBar parentBar = null;
#endregion
#region Constructors
public OutlookBarBandCollection(OutlookBar bar)
{
parentBar = bar;
}
#endregion
#region Methods
public int Add(OutlookBarBand band)
{
if (Contains(band)) return -1;
int index = InnerList.Add(band);
RaiseChanged();
return index;
}
public bool Contains(OutlookBarBand band)
{
return InnerList.Contains(band);
}
public int IndexOf(OutlookBarBand band)
{
return InnerList.IndexOf(band);
}
public void Remove(OutlookBarBand band)
{
// Make sure currentBandIndex is always valid
int currentBandIndex = parentBar.GetCurrentBand();
bool updateCurrentIndex = currentBandIndex != -1 && currentBandIndex == Count - 1;
InnerList.Remove(band);
if ( updateCurrentIndex )
{
// Since we just removed the currently selected band,
// set the new selected band to last band
if ( Count > 0 )
parentBar.SetCurrentBand(Count-1);
}
RaiseChanged();
}
public OutlookBarBand this[int index]
{
get {
if ( index < 0 || index >= Count)
return null;
return (OutlookBarBand) InnerList[index];
}
}
#endregion
#region Implementation
void RaiseChanged()
{
if (Changed != null) Changed(this, null);
}
#endregion
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -