OutLookBar控件的使用

一: OutLookBar 的使用

1 :从网上下载 UtilityLibrary.dll ,并在工程引用中添加该 DLL 。
2 :添加 SplitContainer 控件 .
3 :添加 ImageList 控件。
4 :申明类
private UtilityLibrary.WinControls.OutlookBar outLookBar = null;
private UtilityLibrary.WinControls.OutlookBarBand LinklookBarBand = null;

二:添加函数,在程序启动过程中调用

private void InitializeOutLookBar()
{
    this.outLookBar = new UtilityLibrary.WinControls.OutlookBar();

    this.LinklookBarBand = new UtilityLibrary.WinControls.OutlookBarBand(" 链路管理");
    this.LinklookBarBand.SmallImageList = igl_link;
    this.LinklookBarBand.LargeImageList = igl_link;
    this.LinklookBarBand.Background = System.Drawing.SystemColors.ControlDarkDark;
    this.LinklookBarBand.TextColor = System.Drawing.Color.White;
    this.LinklookBarBand.Items.Add(new UtilityLibrary.WinControls.OutlookBarItem(" 建立链接", 0));
    this.LinklookBarBand.Items.Add(new UtilityLibrary.WinControls.OutlookBarItem(" 断开链接", 1));
    this.outLookBar.Bands.Add(LinklookBarBand);
    this.outLookBar.Dock = System.Windows.Forms.DockStyle.Fill;
    
    this.splitContainer1.Panel1.Controls.AddRange(new System.Windows.Forms.Control[] { this.outLookBar });
    this.outLookBar.ItemClicked += new UtilityLibrary.WinControls.OutlookBarItemClickedHandler(OnOutlookBarItemClicked);
    this.outLookBar.ItemDropped += new UtilityLibrary.WinControls.OutlookBarItemDroppedHandler(OnOutlookBarItemDropped);

}

三:

1: linkForm 为用于
private void OnOutlookBarItemClicked(UtilityLibrary.WinControls.OutlookBarBand band, UtilityLibrary.WinControls.OutlookBarItem item)
{
    switch (item.Text)
    {
        case " 建立链接":
            if (this.linkForm != null)
            {
                this. linkForm.Close();
                this. linkForm = null;
            }
            this. linkForm = new AddPSAMIDForm();
            ShowFormContent(this. linkForm);
            break;

        default:
            break;
    }
}

private void ShowFormContent(System.Windows.Forms.Form showForm)
{
    showForm.TopLevel = false;
    showForm.FormBorderStyle = FormBorderStyle.None;
    showForm.Dock = DockStyle.Fill;
    this.splitContainer1.Panel2.Controls.Add(showForm);
    showForm.Visible = true;
    this.splitContainer1.Panel2.Controls.SetChildIndex(showForm, 0);

 

你可能感兴趣的:(null,dll,imagelist)