Ejemplo n.º 1
0
        /// <summary>
        /// 获取保存在Page的Tag数据中的删除按钮
        /// </summary>
        /// <param name="tabPage"></param>
        /// <returns></returns>
        public static Control getDelPageButByPageTag(TabPage tabPage)
        {
            Control retCon = null;

            if (tabPage != null)
            {
                Dictionary <string, object> tag = ControlsUtilsMet.getControlTagToDic(tabPage);
                if (tag != null && tag.ContainsKey(EnumUtilsMet.GetDescription(DefaultNameEnum.DEF_BUTTON_TAG_KEY)))
                {
                    retCon = (Control)tag[EnumUtilsMet.GetDescription(DefaultNameEnum.DEF_BUTTON_TAG_KEY)];
                }
            }
            return(retCon);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 移除TabPage
 /// </summary>
 /// <param name="tabPage"></param>
 public static void deleteTabPage(TabControl tab, TabPage tabPage)
 {
     if (tabPage != null && tab != null)
     {
         if (tab.TabCount > 1)
         {
             int selIndex = tab.SelectedIndex;
             int delIndex = getTabIndex(tab, tabPage);
             tab.TabPages.Remove(tabPage);
             // 移除page标签所带有的删除按钮
             Dictionary <string, object> tag = ControlsUtilsMet.getControlTagToDic(tabPage);
             if (tag != null && tag.ContainsKey(EnumUtilsMet.GetDescription(DefaultNameEnum.DEF_BUTTON_TAG_KEY)))
             {
                 Control con = (Control)tag[EnumUtilsMet.GetDescription(DefaultNameEnum.DEF_BUTTON_TAG_KEY)];
                 if (con != null && !con.IsDisposed)
                 {
                     con.Dispose();
                 }
             }
         }
     }
 }