当前位置: 首页>>代码示例>>C#>>正文


C# TabControl.GetHashCode方法代码示例

本文整理汇总了C#中System.Windows.Forms.TabControl.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# TabControl.GetHashCode方法的具体用法?C# TabControl.GetHashCode怎么用?C# TabControl.GetHashCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TabControl的用法示例。


在下文中一共展示了TabControl.GetHashCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCustomDrawingMode

        /// <summary>
        /// Sets the tabControl to use the custom drawing mode, 
        /// if the mode or the eventhandler have already been set then
        /// they are not set again.
        /// </summary>
        /// <param name="tabControl">The tabControl to set its custom value.</param>
        /// <param name="property">A custom behaviour value.</param>
        /// <param name="value">True if the custom drawing mode has to be set.</param>
        private static void SetCustomDrawingMode(TabControl tabControl, newPropertiesEnum property, bool value)
        {
            if (tabControl != null)
            {
                int key = tabControl.GetHashCode();
                if (value)
                {
                    if (!ControlOfCustomDrawingMode.ContainsKey(key))
                    {
                        tabControl.DrawMode = TabDrawMode.OwnerDrawFixed;
                        tabControl.DrawItem += TabControl_DrawItem;
                        ControlOfCustomDrawingMode.Add(key, new List<newPropertiesEnum>());
                    }

                    if (!ControlOfCustomDrawingMode[key].Contains(property))
                        ControlOfCustomDrawingMode[key].Add(property);
                }
                else
                {
                    if (ControlOfCustomDrawingMode.ContainsKey(key))
                    {
                        if (ControlOfCustomDrawingMode[key].Contains(property))
                            ControlOfCustomDrawingMode[key].Remove(property);

                        if (ControlOfCustomDrawingMode[key].Count == 0)
                        {
                            tabControl.DrawMode = TabDrawMode.Normal;
                            tabControl.DrawItem -= TabControl_DrawItem;
                            ControlOfCustomDrawingMode.Remove(key);
                        }
                    }
                }
            }
        }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:42,代码来源:SSTabHelper.cs

示例2: GetTabControlPages

 /// <summary>
 /// Gets the TabPages of the Tab Control.
 /// </summary>
 /// <param name="tabControl">The Tab Control to test.</param>
 /// <returns>The visible Tab pages in the Tab Control.</returns>
 private static IList<TabPage> GetTabControlPages(TabControl tabControl)
 {
     int key = tabControl.GetHashCode();
     WeakReference reference = null;
     if (pagesCache.ContainsKey(key))
         reference = pagesCache[key];
     if (reference == null)
         pagesCache[key] = (reference = new WeakReference(null));
     IList<TabPage> result = (IList<TabPage>)reference.Target;
     if (result == null)
     {
         reference.Target = result = new List<TabPage>();
         if (VisibleAffected(tabControl))
             foreach (KeyValuePair<TabPage, bool> pageEntry in TabsVisible[tabControl.GetHashCode()])
                 result.Add(pageEntry.Key);
         else
             foreach (TabPage page in tabControl.TabPages)
                 result.Add(page);
     }
     return result;
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:26,代码来源:SSTabHelper.cs

示例3: ProcessDelayedUseMnemonic

        /// <summary>
        /// Process a UseMnemonic property for a tabControl when this was delayed.
        /// </summary>
        /// <param name="tabControl">The TabControl to process.</param>
        private static void ProcessDelayedUseMnemonic(TabControl tabControl)
        {
            bool value = (bool)newProperties[tabControl.GetHashCode()][newPropertiesEnum.UseMnemonic];

            Form parentForm = tabControl.FindForm();
            int code = parentForm.GetHashCode();
            if (value)
            {
                parentForm.KeyPreview = true;
                parentForm.KeyDown += TabControl_ParentForm_KeyDown;

                if (!FormsWithTabsControlsUsingMnemonic.ContainsKey(code))
                {
                    FormsWithTabsControlsUsingMnemonic.Add(code, new List<TabControl>());
                    FormClosedEventHandler handler = new FormClosedEventHandler(delegate(object sender, FormClosedEventArgs e)
                        {
                            FormsWithTabsControlsUsingMnemonic.Remove(code);
                            parentForm.KeyDown -= TabControl_ParentForm_KeyDown;
                        });
                    parentForm.FormClosed += handler;
                }
                FormsWithTabsControlsUsingMnemonic[code].Add(tabControl);
            }
            else
            {
                parentForm.KeyPreview = false;
                parentForm.KeyDown -= TabControl_ParentForm_KeyDown;

                if (FormsWithTabsControlsUsingMnemonic.ContainsKey(code))
                {
                    if (FormsWithTabsControlsUsingMnemonic[code].Contains(tabControl))
                        FormsWithTabsControlsUsingMnemonic[code].Remove(tabControl);

                    if (FormsWithTabsControlsUsingMnemonic[code].Count == 0)
                        FormsWithTabsControlsUsingMnemonic.Remove(code);
                }
            }
        }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:42,代码来源:SSTabHelper.cs

示例4: GetSelectedTabIndex

 /// <summary>
 /// Used instead of SelectedIndex when SetTabVisible has been used previously in the TabCtrl.
 /// Using SetTabVisible in a TabCtrl may return incorrect values in TabCtrl.SelectedIndex.
 /// </summary>
 /// <param name="TabCtrl">The Tab Control to test.</param>
 public static int GetSelectedTabIndex(TabControl TabCtrl)
 {
     int index = TabCtrl.SelectedIndex;
     UpdateTabsVisible(TabCtrl);
     if (index != -1)
     {
         index = TabsVisible[TabCtrl.GetHashCode()].IndexOf(new KeyValuePair<TabPage, bool>(TabCtrl.SelectedTab, true));
         if (index == -1)
             index = TabsVisible[TabCtrl.GetHashCode()].IndexOf(new KeyValuePair<TabPage, bool>(TabCtrl.SelectedTab, false));
     }
     return index;
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:17,代码来源:SSTabHelper.cs

示例5: CheckNewProperties

 /// <summary>
 /// Checks if the tabControl is controlled by the newProperties Dictionary.
 /// </summary>
 /// <param name="tabControl">The tab control to test.</param>
 private static void CheckNewProperties(TabControl tabControl)
 {
     if (!newProperties.ContainsKey(tabControl.GetHashCode()))
     {
         newProperties[tabControl.GetHashCode()] = new Dictionary<newPropertiesEnum, object>();
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:11,代码来源:SSTabHelper.cs

示例6: Static_SetActiveTabFontStyle

 /// <summary>
 /// Sets the value for the property ActiveTabFontStyle.
 /// </summary>
 /// <param name="tabControl">The tab control to set.</param>
 /// <param name="value">The value to be set.</param>
 private static void Static_SetActiveTabFontStyle(TabControl tabControl, ActiveTabFontStyleEnum value)
 {
     if (CheckForProperty(tabControl, newPropertiesEnum.ActiveFontStyle))
     {
         newProperties[tabControl.GetHashCode()][newPropertiesEnum.ActiveFontStyle] = value;
         if (value != ActiveTabFontStyleEnum.Default)
             SetCustomDrawingMode(tabControl, newPropertiesEnum.ActiveFontStyle, true);
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:14,代码来源:SSTabHelper.cs

示例7: UpdateTabsVisible

 /// <summary>
 /// Internal function to update the TabsVisible for the TabCtrl.
 /// </summary>
 /// <param name="TabCtrl">The Tab Control to update.</param>
 private static void UpdateTabsVisible(TabControl TabCtrl)
 {
     //The tabControl is not in the list of control yet
     if (!TabsVisible.ContainsKey(TabCtrl.GetHashCode()))
     {
         TabsVisible.Add(TabCtrl.GetHashCode(), new List<KeyValuePair<TabPage, bool>>());
         for (int i = 0; i < TabCtrl.TabPages.Count; i++)
         {
             TabsVisible[TabCtrl.GetHashCode()].Add(new KeyValuePair<TabPage, bool>(TabCtrl.TabPages[i], true));
         }
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:16,代码来源:SSTabHelper.cs

示例8: SetSelectedTabIndex

        /// <summary>
        /// Used instead of SelectedIndex when SetTabVisible has been used previously in the TabCtrl.
        /// Using SetTabVisible in a TabCtrl may return incorrect values in TabCtrl.SelectedIndex.
        /// </summary>
        /// <param name="TabCtrl">The Tab Control to test.</param>
        /// <param name="index">The Tab index.</param>
        public static void SetSelectedTabIndex(TabControl TabCtrl, int index)
        {
            UpdateTabsVisible(TabCtrl);

            if (!GetTabVisible(TabCtrl, index))
                throw new InvalidOperationException("Invalid property value");

            TabCtrl.SelectedTab = TabsVisible[TabCtrl.GetHashCode()][index].Key;
        }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:15,代码来源:SSTabHelper.cs

示例9: SetTabCaption

 /// <summary>
 /// Sets the caption of a tab page.
 /// </summary>
 /// <param name="TabCtrl">The TabControl to use.</param>
 /// <param name="index">The index of the tab.</param>
 /// <param name="caption">The caption to set.</param>
 public static void SetTabCaption(TabControl TabCtrl, int index, string caption)
 {
     List<KeyValuePair<TabPage, bool>> list;
     TabsVisible.TryGetValue(TabCtrl.GetHashCode(), out list);
     if (list == null)
     {
         TabCtrl.TabPages[index].Text = caption;
     }
     else
     {
         list[index].Key.Text = caption;
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:19,代码来源:SSTabHelper.cs

示例10: GetTabVisible

        /// <summary>
        /// Sets the current visible status of a tab into a tabcontrol.
        /// </summary>
        /// <param name="TabCtrl">The Tab Control to test.</param>
        /// <param name="index">The Tab index.</param>
        public static bool GetTabVisible(TabControl TabCtrl, int index)
        {
            UpdateTabsVisible(TabCtrl);

            if ((index < 0) || (index >= TabsVisible[TabCtrl.GetHashCode()].Count))
                throw new Exception("Invalid property array index");

            return TabsVisible[TabCtrl.GetHashCode()][index].Value;
        }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:14,代码来源:SSTabHelper.cs

示例11: SetSelectedIndex

 /// <summary>
 /// Selects the specified tab in the TabControl.
 /// </summary>
 /// <param name="TabCtrl">The tab control to use.</param>
 /// <param name="index">The index of the tab to select.</param>
 public static void SetSelectedIndex(TabControl TabCtrl, int index)
 {
     List<KeyValuePair<TabPage, bool>> list;
     TabsVisible.TryGetValue(TabCtrl.GetHashCode(), out list);
     if (list == null)
     {
         TabCtrl.SelectedIndex = index;
     }
     else
     {
         // If the tab is invisible, throw an exception.
         if (!list[index].Value)
         {
             throw new Exception("Run-time error '380':\r\n\r\nInvalid property value");
         }
         TabCtrl.SelectedTab = list[index].Key;
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:23,代码来源:SSTabHelper.cs

示例12: GetTabEnabled

 /// <summary>
 /// Gets the current status of a tab into a tabcontrol.
 /// </summary>
 /// <param name="TabCtrl">The tab control to test.</param>
 /// <param name="index">The tab index.</param>
 public static bool GetTabEnabled(TabControl TabCtrl, int index)
 {
     if (TabsDisabled.ContainsKey(TabCtrl.GetHashCode()))
     {
         return !TabsDisabled[TabCtrl.GetHashCode()].Contains(index);
     }
     return true;
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:13,代码来源:SSTabHelper.cs

示例13: GetTabCount

 /// <summary>
 /// Gets the number of tab pages in a TabControl.
 /// </summary>
 /// <param name="TabCtrl">The TabControl to test.</param>
 /// <returns>The number of tabs in the TabControl.</returns>
 public static int GetTabCount(TabControl TabCtrl)
 {
     List<KeyValuePair<TabPage, bool>> list;
     TabsVisible.TryGetValue(TabCtrl.GetHashCode(), out list);
     if (list == null)
     {
         return TabCtrl.TabPages.Count;
     }
     else
     {
         return list.Count;
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:18,代码来源:SSTabHelper.cs

示例14: GetTabCaption

 /// <summary>
 /// Gets the caption of a tab in a TabControl.
 /// </summary>
 /// <param name="TabCtrl">The TabControl to use.</param>
 /// <param name="index">The index of the tab.</param>
 /// <returns>The caption of the specified tab.</returns>
 public static string GetTabCaption(TabControl TabCtrl, int index)
 {
     List<KeyValuePair<TabPage, bool>> list;
     TabsVisible.TryGetValue(TabCtrl.GetHashCode(), out list);
     if (list == null)
     {
         return TabCtrl.TabPages[index].Text;
     }
     else
     {
         return list[index].Key.Text;
     }
 }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:19,代码来源:SSTabHelper.cs

示例15: Static_GetActiveTabFontStyle

        /// <summary>
        /// Gets the value for the property ActiveTabFontStyle.
        /// </summary>
        /// <param name="tabControl">The tab control to test.</param>
        /// <returns>The current value for ActiveTabFontStyle property.</returns>
        private static ActiveTabFontStyleEnum Static_GetActiveTabFontStyle(TabControl tabControl)
        {
            if (CheckForProperty(tabControl, newPropertiesEnum.ActiveFontStyle))
                return (ActiveTabFontStyleEnum)newProperties[tabControl.GetHashCode()][newPropertiesEnum.ActiveFontStyle];

            return ActiveTabFontStyleEnum.Default;
        }
开发者ID:WebMAPTestUser,项目名称:SKS,代码行数:12,代码来源:SSTabHelper.cs


注:本文中的System.Windows.Forms.TabControl.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。