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


C# Shortcut类代码示例

本文整理汇总了C#中Shortcut的典型用法代码示例。如果您正苦于以下问题:C# Shortcut类的具体用法?C# Shortcut怎么用?C# Shortcut使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ConvertShortcutToString

		public static string ConvertShortcutToString(Shortcut shortcut)
		{
			string shortcutString = Convert.ToString(shortcut);
			StringBuilder result = new StringBuilder(shortcutString);

			if (shortcutString.StartsWith("Alt"))
			{
				result.Insert(3, " + ");
			}
			else if (shortcutString.StartsWith("CtrlShift"))
			{
				result.Insert(9, " + ");
				result.Insert(4, " + ");
			}
			else if (shortcutString.StartsWith("Ctrl"))
			{
				result.Insert(4, " + ");
			}
			else if (shortcutString.StartsWith("Shift"))
			{
				result.Insert(5, " + ");
			}

			return result.ToString();
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:25,代码来源:NuGenShortcutConverter.cs

示例2: TextShortcut

		public TextShortcut(string methodName,
			string shortName, string longName, Shortcut shortcut)
		{
			MethodName = methodName;
			_shortcut = shortcut;
			ShortName = shortName;
			LongName = longName;
		}
开发者ID:rsdn,项目名称:janus,代码行数:8,代码来源:TextShortcut.cs

示例3: Initialize

		private void Initialize(Bitmap bitmap, Shortcut shortcut, EventHandler handler, ImageList list, int imageIndex)
		{
			OwnerDraw = true;
			this.Shortcut = shortcut;
			icon = bitmap;
			clickHandler = handler;
			imageList = list;
			this.imageIndex = imageIndex;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:9,代码来源:MenuItemEx.cs

示例4: ConfigurationUICommand

		/// <summary>
		/// Initialize a new instance of the <see cref="ConfigurationUICommand"/> class.
		/// </summary>		
		/// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
		/// <param name="text">The text for the command.</param>
		/// <param name="longText">The text that will be in the status bar.</param>
		/// <param name="commandState">One of the <see cref="CommandState"/> values.</param>		
		/// <param name="command">The command to execute.</param>		
		/// <param name="shortcut">A short cut for the command.</param>
		/// <param name="insertionPoint">One of the <see cref="InsertionPoint"/> values.</param>
		/// <param name="icon">The icon for the command.</param>
		public ConfigurationUICommand(IServiceProvider serviceProvider, string text,
			string longText, CommandState commandState,
			ConfigurationNodeCommand command, Shortcut shortcut,
			InsertionPoint insertionPoint, Icon icon) 
			: this(serviceProvider,
			text, longText, commandState, NodeMultiplicity.Allow, command, null,
			shortcut, insertionPoint, icon)
		{			
		}
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:20,代码来源:ConfigurationUICommand.cs

示例5: ShortcutToString

        private static string ShortcutToString(Shortcut shortcut)
        {
            if (shortcut != Shortcut.None)
            {
                Keys keys = (Keys)shortcut;
                return TypeDescriptor.GetConverter(keys.GetType()).ConvertToString(keys);
            }

            return null;
        }
开发者ID:RoDaniel,项目名称:featurehouse,代码行数:10,代码来源:OwnerDrawnMenu.cs

示例6: RegisterHotkey

		protected bool RegisterHotkey(Shortcut key)
		{	//register hotkey
			int mod=0;
			Keys k2=Keys.None;
			if (((int)key & (int)Keys.Alt)==(int)Keys.Alt) {mod+=(int)Win32.Modifiers.MOD_ALT;k2=Keys.Alt;}
			if (((int)key & (int)Keys.Shift)==(int)Keys.Shift) {mod+=(int)Win32.Modifiers.MOD_SHIFT;k2=Keys.Shift;}
			if (((int)key & (int)Keys.Control)==(int)Keys.Control) {mod+=(int)Win32.Modifiers.MOD_CONTROL;k2=Keys.Control;}
			
			System.Diagnostics.Debug.Write(mod.ToString()+" ");
			System.Diagnostics.Debug.WriteLine((((int)key)-((int)k2)).ToString());

			return Win32.User32.RegisterHotKey(m_Window.Handle,this.GetType().GetHashCode(),(int)mod,((int)key)-((int)k2));
		}
开发者ID:d-kakhiani,项目名称:C_Sharp,代码行数:13,代码来源:SystemHotkey.cs

示例7: AddMenuItem

 private static MenuItem AddMenuItem(
     Menu menu, string text, EventHandler handler, object context,
     Shortcut shortcut = Shortcut.None)
 {
     var item = new MenuItem(text, handler)
     {
         Tag = context,
         Shortcut = shortcut,
         ShowShortcut = shortcut != Shortcut.None
     };
     menu.MenuItems.Add(item);
     return item;
 }
开发者ID:nemec,项目名称:Fiddler-Launchpad,代码行数:13,代码来源:LaunchpadView.cs

示例8: ConfigurationMenuItem

 /// <summary>
 /// <para>Initializes a new instance of the class with a specified caption, event handler, associated shortcut key, icon, status bar text, and the insertion point for the menu item.</para>
 /// </summary>
 /// <param name="text">
 /// <para>The caption for the menu item.</para>
 /// </param>
 /// <param name="command">
 /// <para>The <see cref="ConfigurationNodeCommand"/> to execute.</para>
 /// </param>
 /// <param name="node">
 /// <para>The <see cref="ConfigurationNode"/> to execute the command upon.</para>
 /// </param>
 /// <param name="shortcut">
 /// <para>One of the <see cref="Shortcut"/> values.</para>
 /// </param>
 /// <param name="statusBarText">
 /// <para>The text for the status bar.</para>
 /// </param>
 /// <param name="insertionPoint">
 /// <para>One of the <see cref="InsertionPoint"/> values.</para>
 /// </param>
 public ConfigurationMenuItem(string text, ConfigurationNodeCommand command, ConfigurationNode node, Shortcut shortcut, string statusBarText, InsertionPoint insertionPoint)
     : base(text, null, shortcut)
 {
     if (command == null)
     {
         throw new ArgumentNullException("command");
     }
     if (node == null)
     {
         throw new ArgumentNullException("node");
     }
     this.statusBarText = statusBarText;
     this.insertionPoint = insertionPoint;
     this.command = command;
     this.node = node;
 }
开发者ID:bnantz,项目名称:NCS-V1-1,代码行数:37,代码来源:ConfigurationMenuItem.cs

示例9: MenuItem

	public MenuItem(MenuMerge mergeType, int mergeOrder, Shortcut shortcut,
					String text, EventHandler onClick, EventHandler onPopup,
					EventHandler onSelect, MenuItem[] items)
			: base(items)
			{
				this.flags = ItemFlags.Default;
				this.mergeType = mergeType;
				this.mergeOrder = mergeOrder;
				this.shortcut = shortcut;
				this.text = text;
				if(onClick != null)
				{
					Click += onClick;
				}
				if(onPopup != null)
				{
					Popup += onPopup;
				}
				if(onSelect != null)
				{
					Select += onSelect;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:23,代码来源:MenuItem.cs

示例10: MenuCommand

 public MenuCommand(string text, Shortcut shortcut, EventHandler clickHandler)
 {
     InternalConstruct(text, null, -1, shortcut, clickHandler);
 }
开发者ID:krishnais,项目名称:ProfileSharp,代码行数:4,代码来源:MenuCommand.cs

示例11: ToolBarItem

		public ToolBarItem(Image image, string text, EventHandler clickHandler, Shortcut shortcut)
		{
			Initialize(image, text, clickHandler, shortCut, null);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:4,代码来源:ToolBarItem.cs

示例12: MxMenuItem

 public MxMenuItem(string text, string helpText, Shortcut shortcut)
     : base(MenuMerge.Add, 0, shortcut, text, null, null, null, null)
 {
     this._helpText = helpText;
     if (shortcut != Shortcut.None)
     {
         this._shortcutText = TypeDescriptor.GetConverter(typeof(Keys)).ConvertToString((Keys) shortcut);
     }
     base.OwnerDraw = true;
 }
开发者ID:ikvm,项目名称:webmatrix,代码行数:10,代码来源:MxMenuItem.cs

示例13: ShouldIgnore

 public bool ShouldIgnore(Shortcut shortcut)
 {
     if (maskedShortcuts != null && maskedShortcuts.Contains(shortcut))
         return true;
     return false;
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:6,代码来源:CommandManager.cs

示例14: Execute

        public override void Execute(DirectoryInfo targetDirectory, PortableEnvironment portableEnvironment)
        {
            var shortcut = new Shortcut
                               {
                                   FileName = Path.Combine(portableEnvironment.Shortcuts.StartMenuTargetDirectory, FileName),
                                   Target = Path.Combine(targetDirectory.FullName, Target),
                                   Arguments = Arguments,
                                   WorkingDirectory = string.IsNullOrWhiteSpace(WorkingDirectory) ? null : Path.Combine(targetDirectory.FullName, WorkingDirectory),
                                   IconPath = string.IsNullOrWhiteSpace(IconPath) ? null : Path.Combine(targetDirectory.FullName, IconPath),
                                   DisplayMode = DisplayMode,
                                   Description = Description,
                               };

            // Create the link file.
            portableEnvironment.Shortcuts.Add(shortcut);
        }
开发者ID:wernight,项目名称:papps-manager,代码行数:16,代码来源:ShortcutCommand.cs

示例15: IgnoreShortcut

 /// <summary>
 /// Instructs the command manager to ignore the shortcut until
 /// UnignoreShortcut is called.
 ///
 /// LIMITATION: You cannot currently ignore an AdvancedShortcut
 /// (i.e. one based on Keys instead of Shortcut).
 /// </summary>
 public void IgnoreShortcut(Shortcut shortcut)
 {
     if (maskedShortcuts == null)
         maskedShortcuts = new HashSet();
     bool isNewElement = maskedShortcuts.Add(shortcut);
     Debug.Assert(isNewElement, "Shortcut " + shortcut + " was already masked");
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:14,代码来源:CommandManager.cs


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