DotnetBar SuperTabIControl实现 MDI效果

序言:在开发一个淘宝应用,想实现 Mdi那样的效果,但是Winform的MDI这个觉得不好,看到别人用Tab这个控件给实现了效果还不错;所以我用Dotnetbar 的SuperTabIControl 实现MDI效果;效果还是不错的;

如图所示:

实现代码:

        private void btnItemSingleMemo_Click(object sender, EventArgs e)
        {
            SingleMemoFrm singlememoFrm = new SingleMemoFrm();
            OpenForm(singlememoFrm, sender.ToString());
        }
        private void OpenForm(Form form,string  caption)
        {
            bool IsOpened = false;
            foreach (SuperTabItem tabitem in NavTabControl.Tabs)
            {
                if (tabitem.Name == caption)
                {
                    NavTabControl.SelectedTab = tabitem;
                    IsOpened = true;
                    break;
                }
            }
            if (!IsOpened)
            {
                SuperTabItem superTabItem = new SuperTabItem();
                superTabItem.Name = caption;
                superTabItem.Text = caption;
                NavTabControl.Tabs.Add(superTabItem);
                NavTabControl.SelectedTab = superTabItem;
            }
           
        }

  

posted @ 2012-01-26 16:27  画方软件  阅读(2610)  评论(0编辑  收藏  举报