本文整理汇总了C#中System.Windows.Forms.ToolStripItem.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItem.GetType方法的具体用法?C# ToolStripItem.GetType怎么用?C# ToolStripItem.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripItem
的用法示例。
在下文中一共展示了ToolStripItem.GetType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeItem
protected override void InitializeItem(ToolStripItem item)
{
base.InitializeItem(item);
if (item.GetType() == typeof(ToolStripSeparator))
{
var castItem = (ToolStripSeparator)item;
if (!castItem.IsOnDropDown)
item.Margin = new Padding(0, 0, 2, 0);
}
if (item.GetType() == typeof(ToolStripButton))
{
item.AutoSize = false;
item.Size = new Size(24, 24);
}
}
示例2: InitializeItem
protected override void InitializeItem(ToolStripItem item)
{
base.InitializeItem(item);
item.ForeColor = Colors.LightText;
if (item.GetType() == typeof(ToolStripSeparator))
{
item.Margin = new Padding(0, 0, 0, 1);
}
}
示例3: GetNewItemDropDown
public static NewItemsContextMenuStrip GetNewItemDropDown(IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider, bool populateCustom)
{
NewItemsContextMenuStrip contextMenu = new NewItemsContextMenuStrip(component, currentItem, onClick, convertTo, serviceProvider);
contextMenu.GroupOrdering.Add("StandardList");
contextMenu.GroupOrdering.Add("CustomList");
foreach (ToolStripItem item in GetStandardItemMenuItems(component, onClick, convertTo))
{
contextMenu.Groups["StandardList"].Items.Add(item);
if (convertTo)
{
ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
{
item2.Enabled = false;
}
}
}
if (populateCustom)
{
GetCustomNewItemDropDown(contextMenu, component, currentItem, onClick, convertTo, serviceProvider);
}
IUIService service = serviceProvider.GetService(typeof(IUIService)) as IUIService;
if (service != null)
{
contextMenu.Renderer = (ToolStripProfessionalRenderer) service.Styles["VsRenderer"];
contextMenu.Font = (Font) service.Styles["DialogFont"];
if (service.Styles["VsColorPanelText"] is System.Drawing.Color)
{
contextMenu.ForeColor = (System.Drawing.Color) service.Styles["VsColorPanelText"];
}
}
contextMenu.Populate();
return contextMenu;
}
示例4: GetCustomNewItemDropDown
public static void GetCustomNewItemDropDown(NewItemsContextMenuStrip contextMenu, IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider)
{
foreach (ToolStripItem item in GetCustomItemMenuItems(component, onClick, convertTo, serviceProvider))
{
contextMenu.Groups["CustomList"].Items.Add(item);
if (convertTo)
{
ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
{
item2.Enabled = false;
}
}
}
contextMenu.Populate();
}
示例5: GetNewItemDropDown
public static ToolStripDropDown GetNewItemDropDown(IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider)
{
NewItemsContextMenuStrip strip = new NewItemsContextMenuStrip(component, currentItem, onClick, convertTo, serviceProvider);
strip.GroupOrdering.Add("StandardList");
strip.GroupOrdering.Add("CustomList");
foreach (ToolStripItem item in GetStandardItemMenuItems(component, onClick, convertTo))
{
strip.Groups["StandardList"].Items.Add(item);
if (convertTo)
{
ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
{
item2.Enabled = false;
}
}
}
foreach (ToolStripItem item3 in GetCustomItemMenuItems(component, onClick, convertTo, serviceProvider))
{
strip.Groups["CustomList"].Items.Add(item3);
if (convertTo)
{
ItemTypeToolStripMenuItem item4 = item3 as ItemTypeToolStripMenuItem;
if (((item4 != null) && (currentItem != null)) && (item4.ItemType == currentItem.GetType()))
{
item4.Enabled = false;
}
}
}
IUIService service = serviceProvider.GetService(typeof(IUIService)) as IUIService;
if (service != null)
{
strip.Renderer = (ToolStripProfessionalRenderer) service.Styles["VsRenderer"];
strip.Font = (Font) service.Styles["DialogFont"];
}
strip.Populate();
return strip;
}
示例6: OnMouseDown
protected override void OnMouseDown(MouseEventArgs e) {
if(fReorderEnabled) {
mouseButtons = e.Button;
draggingItem = GetItemAt(e.Location);
if((draggingItem != null) && string.Equals(draggingItem.GetType().ToString(), "System.Windows.Forms.ToolStripScrollButton")) {
draggingItem = null;
}
}
base.OnMouseDown(e);
}
示例7: updateMenuEvents
public static Hashtable updateMenuEvents(ToolStripItem control, string elementName, string uniqueId)
{
Hashtable controlProperties = new Hashtable();
string eibCOntrolInterfaceName = (typeof(IEIBControl)).Name;
if (control.GetType().GetInterface(eibCOntrolInterfaceName) != null)
{
IEIBControl eibControl = (IEIBControl)control;
if (eibControl.OnClickValue != null && !eibControl.OnClickValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnClickElt, eibControl.OnClickValue);
}
if (eibControl.OnDoubleClick != null && !eibControl.OnDoubleClick.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnDoubleClickElt, eibControl.OnDoubleClick);
}
if (eibControl.EnteringValue != null && !eibControl.EnteringValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeEnteringElt, eibControl.EnteringValue);
}
if (eibControl.ExitingValue != null && !eibControl.ExitingValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeExitingElt, eibControl.ExitingValue);
}
if (eibControl.DefaultValue != null && !eibControl.DefaultValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeDefaultValueElt, eibControl.DefaultValue);
}
}
//EIBControl Settings
return controlProperties;
}
示例8: RecursiveGetToolStripItems
private static IEnumerable<Control> RecursiveGetToolStripItems(ToolStripItem item, Control x)
{
if (item is ToolStripDropDownItem)
{
foreach (ToolStripItem t in ((ToolStripDropDownItem) item).DropDownItems)
{
if (item.GetType().FullName.IndexOf("MvvmFx.", StringComparison.InvariantCulture) != 0)
{
#if WINFORMS
yield return new ToolStripItemProxy(t, x.Parent, true);
#else
yield return new ToolStripItemProxy(t, x, true);
#endif
}
foreach (var toolStripItems in RecursiveGetToolStripItems(t, x))
yield return toolStripItems;
}
}
}
示例9: updateMenuEvents
public static Hashtable updateMenuEvents(ToolStripItem control, string elementName, string uniqueId)
{
Hashtable controlProperties = new Hashtable();
string eibCOntrolInterfaceName = (typeof(IEIBControl)).Name;
if (control.GetType().GetInterface(eibCOntrolInterfaceName) != null)
{
IEIBControl eibControl = (IEIBControl)control;
if (eibControl.OnClickValue != null && !eibControl.OnClickValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnClickElt, eibControl.OnClickValue);
}
if (eibControl.OnDoubleClick != null && !eibControl.OnDoubleClick.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnDoubleClickElt, eibControl.OnDoubleClick);
}
if (eibControl.EnteringValue != null && !eibControl.EnteringValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeEnteringElt, eibControl.EnteringValue);
}
if (eibControl.ExitingValue != null && !eibControl.ExitingValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeExitingElt, eibControl.ExitingValue);
}
if (eibControl.DefaultValue != null && !eibControl.DefaultValue.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeDefaultValueElt, eibControl.DefaultValue);
}
if (eibControl is EIBPanel)
{
if (((EIBPanel)eibControl).GlobalScripts != null && !((EIBPanel)eibControl).GlobalScripts.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeGlobalScriptsElt, ((EIBPanel)eibControl).GlobalScripts);
}
}
if (eibControl is EIBTreeNode)
{
if (((EIBTreeNode)eibControl).OnOpen != null && !((EIBTreeNode)eibControl).OnOpen.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnOpenElt, ((EIBTreeNode)eibControl).OnOpen);
}
}
if (eibControl is EIBTreeView)
{
if (((EIBTreeView)eibControl).OnSelect != null && !((EIBTreeView)eibControl).OnSelect.Trim().Equals(""))
{
controlProperties.Add(XMLServicesConstants.XmlNodeOnSelectElt, ((EIBTreeView)eibControl).OnSelect);
}
}
}
//EIBControl Settings
return controlProperties;
}