本文整理汇总了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);
}
}
}
示例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, "Удалить");
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例9: OnCreateContextMenu
public override void OnCreateContextMenu (IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
{
menu.Add ("One");
menu.Add ("Two");
menu.Add ("Three");
menu.Add ("Four");
}
示例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");
}
示例11: BeforePopupEventArgs
public BeforePopupEventArgs(IntPtr ptrPopupMenu, IContextMenu iContextMenu, uint defaultCommandID, string defaultCommand)
{
this.ptrPopupMenu = ptrPopupMenu;
this.iContextMenu = iContextMenu;
ContinuePopup = true;
DefaultCommandID = defaultCommandID;
DefaultCommand = defaultCommand;
}
示例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);
}
示例13: OnCreateContextMenu
void View.IOnCreateContextMenuListener.OnCreateContextMenu(IContextMenu menu, View v,
IContextMenuContextMenuInfo menuInfo)
{
if (OnCreateContextMenu != null)
{
OnCreateContextMenu(menu, v, menuInfo);
}
}
示例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;
}
示例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");
}