• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Shortcut类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: UnignoreShortcut

 /// <summary>
 /// Instructs the command manager to respond to the shortcut again.
 /// </summary>
 public void UnignoreShortcut(Shortcut shortcut)
 {
     Trace.Assert(maskedShortcuts != null, "UnignoreShortcut called before IgnoreShortcut");
     if (maskedShortcuts != null)
     {
         bool wasPresent = maskedShortcuts.Remove(shortcut);
         Trace.Assert(wasPresent, "Shortcut " + shortcut + " was not masked");
         if (maskedShortcuts.Count == 0)
             maskedShortcuts = null;
     }
 }
开发者ID:gmilazzoitag,项目名称:OpenLiveWriter,代码行数:14,代码来源:CommandManager.cs


示例17: 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;
            }

            int nonModifiedKey = (int)key - (int)k2;

            return Win32.User32.RegisterHotKey(m_Window.Handle, this.GetType().GetHashCode(), (int)mod, nonModifiedKey);
        }
开发者ID:ckolumbus,项目名称:ptm,代码行数:27,代码来源:SystemHotkey.cs


示例18: MenuItemEx

		public MenuItemEx(string name, ImageList imageList, int imageIndex, Shortcut shortcut, EventHandler handler) : this(name, handler)
		{
			Initialize(icon, shortcut, handler, imageList, imageIndex);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:4,代码来源:MenuItemEx.cs


示例19: InternalConstruct

        protected void InternalConstruct(string text, 
                                         ImageList imageList, 
                                         int imageIndex, 
                                         Shortcut shortcut, 
                                         EventHandler clickHandler)
        {
            // Save parameters
            _text = text;
            _imageList = imageList;
            _imageIndex = imageIndex;
            _shortcut = shortcut;
            _description = text;

            if (clickHandler != null)
                Click += clickHandler;

            // Define defaults for others
            _enabled = true;
            _checked = false;
            _radioCheck = false;
            _break = false;
            _tag = null;
            _visible = true;
            _infrequent = false;
            _image = null;

            // Create the collection of embedded menu commands
            _menuItems = new MenuCommandCollection();
        }
开发者ID:krishnais,项目名称:ProfileSharp,代码行数:29,代码来源:MenuCommand.cs


示例20: ConfigurationLoad

            /// <summary>
            /// Load all configuration and override the current values
            /// </summary>
            /// <returns></returns>
            public static bool ConfigurationLoad()
            {
                // Check if config file is present
                Restore(ConfigFile);
                bool Protocols = false;
                if (File.Exists(ConfigFile))
                {
                    try
                    {
                        XmlDocument configuration = new XmlDocument();
                        configuration.Load(ConfigFile);
                        lock (Configuration.ShortcutKeylist)
                        {
                            Configuration.ShortcutKeylist = new List<Shortcut>();
                        }
                        lock (Ignoring.IgnoreList)
                        {
                            Ignoring.IgnoreList.Clear();
                        }
                        lock (Configuration.HighlighterList)
                        {
                            Configuration.HighlighterList = new List<Network.Highlighter>();
                        }
                        lock (NetworkData.Networks)
                        {
                            NetworkData.Networks.Clear();
                        }
                        lock (Configuration.UserData.History)
                        {
                            Configuration.UserData.History.Clear();
                        }
                        Commands.ClearAliases();
                        foreach (XmlNode node in configuration.ChildNodes)
                        {
                            if (node.Name == "configuration.pidgeon")
                            {
                                foreach (XmlNode curr in node.ChildNodes)
                                {
                                    if (curr.Name == "history")
                                    {
                                        lock (Configuration.UserData.History)
                                        {
                                            Configuration.UserData.History.Add(curr.InnerText);
                                        }
                                        continue;
                                    }
                                    if (curr.Attributes == null)
                                    {
                                        continue;
                                    }
                                    if (curr.Attributes.Count > 0)
                                    {
                                        if (curr.Name.StartsWith("extension.", StringComparison.Ordinal))
                                        {
                                            Configuration.SetConfig(curr.Name.Substring(10), curr.InnerText);
                                            continue;
                                        }
                                        if (curr.Name == "alias")
                                        {
                                            Commands.RegisterAlias(curr.Attributes[0].InnerText, curr.Attributes[1].InnerText, bool.Parse(curr.Attributes[2].InnerText));
                                            continue;
                                        }
                                        if (curr.Name == "network")
                                        {
                                            if (curr.Attributes.Count > 3)
                                            {
                                                NetworkData.NetworkInfo info = new NetworkData.NetworkInfo();
                                                foreach (XmlAttribute xx in curr.Attributes)
                                                {
                                                    switch (xx.Name.ToLower())
                                                    {
                                                        case "name":
                                                            info.Name = xx.Value;
                                                            break;
                                                        case "server":
                                                            info.Server = xx.Value;
                                                            break;
                                                        case "ssl":
                                                            info.SSL = bool.Parse(xx.Value);
                                                            break;
                                                    }
                                                }
                                                lock (NetworkData.Networks)
                                                {
                                                    NetworkData.Networks.Add(info);
                                                }
                                            }
                                            continue;
                                        }
                                        if (curr.Name == "window")
                                        {
                                            string name = curr.InnerText;
                                            PidgeonGtkToolkit.PidgeonForm.Info w = new PidgeonGtkToolkit.PidgeonForm.Info();
                                            if (curr.Attributes == null)
                                            {
                                                continue;
//.........这里部分代码省略.........
开发者ID:JGunning,项目名称:OpenAIM,代码行数:101,代码来源:Config_Core.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ShowDialog类代码示例发布时间:2022-05-24
下一篇:
C# ShoppingCartType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap