本文整理汇总了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();
}
示例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]);
}
示例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;
}
示例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;
}