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


C# IContextMenu类代码示例

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


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

示例1: ContextMenuStrip_Opening

 private void ContextMenuStrip_Opening(object sender, CancelEventArgs e)
 {
     ContextMenuStrip strip = (ContextMenuStrip) sender;
     if ((strip.Items.Count <= 1) && (strip.Items[0].Text == string.Empty))
     {
         if ((this.ContextMenu == null) && (this.FileNames != null))
         {
             this.ContextMenu = GetContextMenu(this.Owner, this.ParentName, this.FileNames);
         }
         if (this.ContextMenu == null)
         {
             e.Cancel = true;
         }
         else
         {
             this.ContextMenu3 = this.ContextMenu as IContextMenu3;
             if (this.ContextMenu3 == null)
             {
                 this.ContextMenu2 = this.ContextMenu as IContextMenu2;
             }
             this.Menu = Windows.CreatePopupMenu();
             this.ContextMenu.QueryContextMenu(this.Menu, 0, 1, 0x7fff, this.Options | (((Control.ModifierKeys & Keys.Shift) > Keys.None) ? CMF.CMF_EXTENDEDVERBS : CMF.CMF_NORMAL));
             if (this.ContextMenu3 != null)
             {
                 this.ContextMenu3.HandleMenuMsg2(0x117, this.Menu, IntPtr.Zero, IntPtr.Zero);
             }
             else if (this.ContextMenu2 != null)
             {
                 this.ContextMenu2.HandleMenuMsg(0x117, this.Menu, IntPtr.Zero);
             }
             this.InitializeToolStrip(strip, this.Menu);
         }
     }
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:34,代码来源:ShellContextMenuHelper.cs

示例2: OnCreateContextMenu

 public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo info)
 {
     base.OnCreateOptionsMenu (menu);
     menu.SetHeaderTitle("Выберите действие");
     menu.Add(0, MENU_ITEM_EDIT, 0, "Редактировать");
     menu.Add(0, MENU_ITEM_DELETE, 0, "Удалить");
 }
开发者ID:pafik13,项目名称:PresenterPlanner,代码行数:7,代码来源:DoctorsList.cs

示例3: OnCreateContextMenu

        public override void OnCreateContextMenu(IContextMenu menu, View v,
			IContextMenuContextMenuInfo  menuInfo)
        {
            AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo;
            ClickView cv = (ClickView) acmi.TargetView;
            cv.OnCreateMenu(menu, menuInfo);
        }
开发者ID:pythe,项目名称:wristpass,代码行数:7,代码来源:SearchResults.cs

示例4: GetCommandStringW

        /// <summary>
        /// Retrieves the command string for a specific item from an iContextMenu (Unicode)
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu to receive the string from</param>
        /// <param name="idcmd">the id of the specific item</param>
        /// <param name="executeString">indicating whether it should return an execute string or not</param>
        /// <returns>if executeString is true it will return the executeString for the item, 
        /// otherwise it will return the help info string</returns>
        public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString)
        {
            string info = string.Empty;
            byte[] bytes = new byte[256];

            iContextMenu.GetCommandString(
                                            idcmd,
                                            (executeString ? ShellAPI.GCS.VERBW : ShellAPI.GCS.HELPTEXTW),
                                            0,
                                            bytes,
                                            ShellAPI.MAX_PATH);

            int index = 0;
            while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0))
            {
                index += 2;
            }

            if (index < bytes.Length - 1)
            {
                info = Encoding.Unicode.GetString(bytes, 0, index + 1);
            }

            return info;
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:ContextMenuHelper.cs

示例5: GetCommandStringW

        /// <summary>
        /// Retrieves the command string for a specific item from an iContextMenu (Unicode)
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu to receive the string from</param>
        /// <param name="idcmd">the id of the specific item</param>
        /// <param name="executeString">indicating whether it should return an execute string or not</param>
        /// <returns>if executeString is true it will return the executeString for the item, 
        /// otherwise it will return the help info string</returns>
        public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString)
        {
            string info = string.Empty;
            byte[] bytes = new byte[256];

            iContextMenu.GetCommandString(
                                            idcmd,
                                            (executeString ? GCS.VerbW : GCS.HelpTextW),
                                            0,
                                            bytes,
                                            ShellApi.MaxPath);

            int index = 0;
            while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0))
            {
                index += 2;
            }

            if (index < bytes.Length - 1)
            {
                info = Encoding.Unicode.GetString(bytes, 0, index + 1);
            }

            return info;
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:ContextMenuHelper.cs

示例6: GetCommandStringA

        /// <summary>
        /// Retrieves the command string for a specific item from an iContextMenu (Ansi)
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu to receive the string from</param>
        /// <param name="idcmd">the id of the specific item</param>
        /// <param name="executeString">indicating whether it should return an execute string or not</param>
        /// <returns>if executeString is true it will return the executeString for the item, 
        /// otherwise it will return the help info string</returns>
        public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString)
        {
            string info = string.Empty;
            byte[] bytes = new byte[256];

            iContextMenu.GetCommandString(
                                          idcmd,
                                          (executeString ? ShellAPI.GCS.VERBA : ShellAPI.GCS.HELPTEXTA),
                                          0,
                                          bytes,
                                          ShellAPI.MAX_PATH);

            int index = 0;
            while (index < bytes.Length && bytes[index] != 0)
            {
                index++;
            }

            if (index < bytes.Length)
            {
                info = Encoding.Default.GetString(bytes, 0, index);
            }

            return info;
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:ContextMenuHelper.cs

示例7: GetCommandStringA

        /// <summary>
        /// Retrieves the command string for a specific item from an iContextMenu (Ansi)
        /// </summary>
        /// <param name="iContextMenu">the IContextMenu to receive the string from</param>
        /// <param name="idcmd">the id of the specific item</param>
        /// <param name="executeString">indicating whether it should return an execute string or not</param>
        /// <returns>if executeString is true it will return the executeString for the item, 
        /// otherwise it will return the help info string</returns>
        public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString)
        {
            string info = string.Empty;
            byte[] bytes = new byte[256];

            iContextMenu.GetCommandString(
                                          idcmd,
                                          (executeString ? GCS.VerbA : GCS.HelpTextA),
                                          0,
                                          bytes,
                                          ShellApi.MaxPath);

            int index = 0;
            while (index < bytes.Length && bytes[index] != 0)
            {
                index++;
            }

            if (index < bytes.Length)
            {
                info = Encoding.Default.GetString(bytes, 0, index);
            }

            return info;
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:33,代码来源:ContextMenuHelper.cs

示例8: OnCreateContextMenu

            public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
            {
                base.OnCreateContextMenu (menu, v, menuInfo);

                menu.Add(Menu.None, Resource.Id.a_item, Menu.None, "Menu A");
                menu.Add(Menu.None, Resource.Id.b_item, Menu.None, "Menu B");
            }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:7,代码来源:FragmentContextMenuSupport.cs

示例9: OnCreateContextMenu

		public override void OnCreateContextMenu (IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
		{
			menu.Add ("One");
			menu.Add ("Two");
			menu.Add ("Three");
			menu.Add ("Four");
		}
开发者ID:adbk,项目名称:spikes,代码行数:7,代码来源:ContextMenus.cs

示例10: OnCreateContextMenu

        public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
        {
            base.OnCreateContextMenu (menu, v, menuInfo);

            menu.Add (0, 0, 0, "Hide App");
            menu.Add (0, 1, 1, "Uninstall App");
        }
开发者ID:Redth,项目名称:FlamedTVLauncher,代码行数:7,代码来源:MainActivity.cs

示例11: BeforePopupEventArgs

 public BeforePopupEventArgs(IntPtr ptrPopupMenu, IContextMenu iContextMenu, uint defaultCommandID, string defaultCommand)
 {
     this.ptrPopupMenu = ptrPopupMenu;
     this.iContextMenu = iContextMenu;
     ContinuePopup = true;
     DefaultCommandID = defaultCommandID;
     DefaultCommand = defaultCommand;
 }
开发者ID:Choi-Insu,项目名称:arrengers,代码行数:8,代码来源:ContextMenuWrapper.cs

示例12: OnCreateContextMenu

		public override void OnCreateContextMenu (IContextMenu menu, View view, IContextMenuContextMenuInfo menuInfo)
		{
			var info = (AdapterView.AdapterContextMenuInfo)menuInfo;
			var note = (Note)ListAdapter.GetItem (info.Position);

			// Add a menu item to delete the note
			menu.Add (0, MENU_ITEM_DELETE, 0, Resource.String.menu_delete);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:8,代码来源:NotesListActivity.cs

示例13: OnCreateContextMenu

 void View.IOnCreateContextMenuListener.OnCreateContextMenu(IContextMenu menu, View v,
                                                            IContextMenuContextMenuInfo menuInfo)
 {
     if (OnCreateContextMenu != null)
     {
         OnCreateContextMenu(menu, v, menuInfo);
     }
 }
开发者ID:jlarsson,项目名称:MonoDroid.Simplified,代码行数:8,代码来源:OnCreateContextMenuListener.cs

示例14: ShellContextMenuHelper

 private ShellContextMenuHelper(IWin32Window owner, IContextMenu contextMenu, ContextMenuOptions options, EventHandler<ExecuteVerbEventArgs> onExecuteVerb)
 {
     this.ItemContainer = new Container();
     this.OnExecuteVerb = null;
     this.Owner = owner;
     this.ContextMenu = contextMenu;
     this.Options = ((((options & ContextMenuOptions.Explore) > 0) ? (CMF.CMF_NORMAL | CMF.CMF_EXPLORE) : CMF.CMF_NORMAL) | (((options & ContextMenuOptions.CanRename) > 0) ? CMF.CMF_CANRENAME : CMF.CMF_NORMAL)) | (((options & ContextMenuOptions.VerbsOnly) > 0) ? (CMF.CMF_NORMAL | CMF.CMF_VERBSONLY) : CMF.CMF_NORMAL);
     this.OnExecuteVerb = onExecuteVerb;
 }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:9,代码来源:ShellContextMenuHelper.cs

示例15: OnCreateContextMenu

		public override void OnCreateContextMenu (IContextMenu menu, View view, IContextMenuContextMenuInfo menuInfo)
		{
			base.OnCreateContextMenu (menu, view, menuInfo);
			AdapterView.AdapterContextMenuInfo info =(AdapterView.AdapterContextMenuInfo) menuInfo;
			Tunnel.Client client = listAdapter[info.Position];
			menu.SetHeaderTitle("Client " + client.ID+" at " + client.Address);
			menu.Add(Menu.None,0,0,"Throw off");

		}
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:9,代码来源:ClientsActivity.cs


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