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


C# ToolStrip.GetType方法代码示例

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


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

示例1: GetHashCodeOf

    //
    // Archivage
    //

    private int GetHashCodeOf( ToolStrip strip ) {
      string key = strip.GetType().Name + ':' + strip.Name;
      foreach ( ToolStripItem item in strip.Items )
        key += item.GetType().Name + ':' + item.Name;
      return key.GetHashCode();
    }
开发者ID:NicolasR,项目名称:Composants,代码行数:10,代码来源:ToolStripPanelEnh.cs

示例2: RemoveItemClickedEvent

 private static void RemoveItemClickedEvent(ToolStrip b)
 {
     FieldInfo f1 = typeof (ToolStrip).GetField("EventItemClicked",
                                                BindingFlags.Static | BindingFlags.NonPublic);
     object obj = f1.GetValue(b);
     PropertyInfo pi = b.GetType().GetProperty("Events",
                                               BindingFlags.NonPublic | BindingFlags.Instance);
     EventHandlerList list = (EventHandlerList) pi.GetValue(b, null);
     list.RemoveHandler(obj, list[obj]);
 }
开发者ID:kaduardo,项目名称:cyberduck,代码行数:10,代码来源:BrowserForm.cs

示例3: Merge

 public static bool Merge(ToolStrip sourceToolStrip, ToolStrip targetToolStrip)
 {
     if (sourceToolStrip == null)
     {
         throw new ArgumentNullException("sourceToolStrip");
     }
     if (targetToolStrip == null)
     {
         throw new ArgumentNullException("targetToolStrip");
     }
     if (targetToolStrip == sourceToolStrip)
     {
         throw new ArgumentException(System.Windows.Forms.SR.GetString("ToolStripMergeImpossibleIdentical"));
     }
     bool flag = IsSpecialMDIStrip(sourceToolStrip) || ((sourceToolStrip.AllowMerge && targetToolStrip.AllowMerge) && (sourceToolStrip.GetType().IsAssignableFrom(targetToolStrip.GetType()) || targetToolStrip.GetType().IsAssignableFrom(sourceToolStrip.GetType())));
     MergeHistory history = null;
     if (flag)
     {
         history = new MergeHistory(sourceToolStrip);
         int count = sourceToolStrip.Items.Count;
         if (count > 0)
         {
             sourceToolStrip.SuspendLayout();
             targetToolStrip.SuspendLayout();
             try
             {
                 int num2 = count;
                 int num3 = 0;
                 int num4 = 0;
                 while (num3 < count)
                 {
                     ToolStripItem source = sourceToolStrip.Items[num4];
                     MergeRecursive(source, targetToolStrip.Items, history.MergeHistoryItemsStack);
                     int num5 = num2 - sourceToolStrip.Items.Count;
                     num4 = (num5 > 0) ? num4 : (num4 + 1);
                     num2 = sourceToolStrip.Items.Count;
                     num3++;
                 }
             }
             finally
             {
                 sourceToolStrip.ResumeLayout();
                 targetToolStrip.ResumeLayout();
             }
             if (history.MergeHistoryItemsStack.Count > 0)
             {
                 targetToolStrip.MergeHistoryStack.Push(history);
             }
         }
     }
     bool flag2 = false;
     if ((history != null) && (history.MergeHistoryItemsStack.Count > 0))
     {
         flag2 = true;
     }
     return flag2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:ToolStripManager.cs

示例4: Merge

        /// <include file='doc\ToolStripManager.uex' path='docs/doc[@for="ToolStripManager.Merge"]/*' />
        /// <devdoc> 
        /// merge two toolstrips
        /// </devdoc>
        public static bool Merge(ToolStrip sourceToolStrip, ToolStrip targetToolStrip) {
            // check arguments
            if (sourceToolStrip == null) {
                throw new ArgumentNullException("sourceToolStrip");
            }
            if (targetToolStrip == null) {
                throw new ArgumentNullException("targetToolStrip");
            }
            if (targetToolStrip == sourceToolStrip) {
                throw new ArgumentException(SR.GetString(SR.ToolStripMergeImpossibleIdentical));
            }

            // we only do this if the source and target toolstrips are the same
            bool canMerge = IsSpecialMDIStrip(sourceToolStrip);
            canMerge = (canMerge || (sourceToolStrip.AllowMerge &&
                                      targetToolStrip.AllowMerge &&
                                      (sourceToolStrip.GetType().IsAssignableFrom(targetToolStrip.GetType()) || targetToolStrip.GetType().IsAssignableFrom(sourceToolStrip.GetType()))
                                    )
                        );
            MergeHistory mergeHistory = null;
            if (canMerge) {
                //Debug.WriteLine("Begin merge between src: " + sourceToolStrip.Name + " and target: " + targetToolStrip.Name);
                Debug.Indent();
                mergeHistory = new MergeHistory(sourceToolStrip);


                int originalCount = sourceToolStrip.Items.Count;

                if (originalCount > 0) {
                    sourceToolStrip.SuspendLayout();
                    targetToolStrip.SuspendLayout();
                    try {
                        int lastCount = originalCount;

                        // 2. do the actual merging logic
                        for (int i = 0, itemToLookAt = 0; i < originalCount; i++) {
                            ToolStripItem item = sourceToolStrip.Items[itemToLookAt];
                            //Debug.WriteLine("doing the recursive merge for item " + item.Text);
                            MergeRecursive(item, targetToolStrip.Items, mergeHistory.MergeHistoryItemsStack);

                            int numberOfItemsMerged = lastCount - sourceToolStrip.Items.Count;
                            itemToLookAt = (numberOfItemsMerged > 0) ? itemToLookAt : itemToLookAt + 1;
                            lastCount = sourceToolStrip.Items.Count;
                        }
                    }
                    finally {
                        Debug.Unindent();
                        sourceToolStrip.ResumeLayout();
                        targetToolStrip.ResumeLayout();
                    }
                    //Debug.WriteLine("pusing mergehistory for toolstrip " + sourceToolStrip.Name + " in target toolstrip MergeHistoryStack property");
                    if (mergeHistory.MergeHistoryItemsStack.Count > 0) {
                        // only push this on the stack if we actually did something
                        targetToolStrip.MergeHistoryStack.Push(mergeHistory);
                    }
                }
            }
            bool result = false;
            if (mergeHistory != null && mergeHistory.MergeHistoryItemsStack.Count > 0) {
                result = true; // we did merge something
            }
            return result;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:67,代码来源:ToolStripManager.cs


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