307 lines
20 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<Type Name="ContextMenu" FullName="System.Windows.Forms.ContextMenu">
<TypeSignature Language="C#" Value="public class ContextMenu : System.Windows.Forms.Menu" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Forms.Menu</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultEvent("Popup")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>The <see cref="T:System.Windows.Forms.ContextMenu" /> class represents shortcut menus that can be displayed when the user clicks the right mouse button over a control or area of the form. Shortcut menus are typically used to combine different menu items from a <see cref="T:System.Windows.Forms.MainMenu" /> of a form that are useful for the user given the context of the application. For example, you can use a shortcut menu assigned to a <see cref="T:System.Windows.Forms.TextBox" /> control to provide menu items for changing the font of the text, finding text within the control, or Clipboard features for copying and pasting text. You can also display new <see cref="T:System.Windows.Forms.MenuItem" /> objects in a shortcut menu that are not located within a <see cref="T:System.Windows.Forms.MainMenu" /> to provide situation specific commands that are not appropriate for the <see cref="T:System.Windows.Forms.MainMenu" /> to display.</para>
<para>Typically, a shortcut menu is displayed when a user clicks the right mouse button over a control or the form itself. Visible controls and <see cref="T:System.Windows.Forms.Form" /> have a <see cref="P:System.Windows.Forms.Control.ContextMenu" /> property that binds the <see cref="T:System.Windows.Forms.ContextMenu" /> class to the control that displays the shortcut menu. More than one control can use a <see cref="T:System.Windows.Forms.ContextMenu" />. You can use the <see cref="P:System.Windows.Forms.ContextMenu.SourceControl" /> property to determine which control last displayed the shortcut menu in order to perform tasks specific to the control or to modify the shortcut menu displayed for the control.</para>
<para>You might want to know when the shortcut menu is being displayed in order to set check marks, disable items, and perform other menu tasks before the menu is displayed to the user. You can handle the <see cref="E:System.Windows.Forms.ContextMenu.Popup" /> event to determine when the shortcut menu is being displayed.</para>
<block subset="none" type="note">
<para>In order to reuse <see cref="T:System.Windows.Forms.MenuItem" /> objects that are displayed in a <see cref="T:System.Windows.Forms.MainMenu" /> for use in a <see cref="T:System.Windows.Forms.ContextMenu" />, you must create a copy of the menu using the <see cref="M:System.Windows.Forms.MenuItem.CloneMenu" /> method of the <see cref="T:System.Windows.Forms.MenuItem" /> class. You can also merge menu items and their submenu items into a single <see cref="T:System.Windows.Forms.MenuItem" /> object using the <see cref="M:System.Windows.Forms.MenuItem.MergeMenu" /> method of the <see cref="T:System.Windows.Forms.MenuItem" /> class.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Represents a shortcut menu. Although <see cref="T:System.Windows.Forms.ContextMenuStrip" /> replaces and adds functionality to the <see cref="T:System.Windows.Forms.ContextMenu" /> control of previous versions, <see cref="T:System.Windows.Forms.ContextMenu" /> is retained for both backward compatibility and future use if you choose.</para>
</summary>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ContextMenu ();" />
<MemberType>Constructor</MemberType>
<Parameters />
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Once you have used this version of the constructor, you can add menu items to the <see cref="T:System.Windows.Forms.ContextMenu" /> by using the <see cref="M:System.Windows.Forms.Menu.MenuItemCollection.Add(System.String)" /> method of the <see cref="T:System.Windows.Forms.Menu.MenuItemCollection" /> class. You can access the <see cref="T:System.Windows.Forms.Menu.MenuItemCollection" /> through the <see cref="P:System.Windows.Forms.Menu.MenuItems" /> property.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Windows.Forms.ContextMenu" /> class with no menu items specified.</para>
</summary>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ContextMenu (System.Windows.Forms.MenuItem[] menuItems);" />
<MemberType>Constructor</MemberType>
<Parameters>
<Parameter Name="menuItems" Type="System.Windows.Forms.MenuItem[]" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>You can use this version of the constructor to create a <see cref="T:System.Windows.Forms.ContextMenu" /> that has its menu items specified at the time it is created. Once you have used this version of the constructor, you can add additional menu items to the <see cref="T:System.Windows.Forms.ContextMenu" /> by using the <see cref="M:System.Windows.Forms.Menu.MenuItemCollection.Add(System.String)" /> method of the <see cref="T:System.Windows.Forms.Menu.MenuItemCollection" /> class. You can access the <see cref="T:System.Windows.Forms.Menu.MenuItemCollection" /> through the <see cref="P:System.Windows.Forms.Menu.MenuItems" /> property.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Initializes a new instance of the <see cref="T:System.Windows.Forms.ContextMenu" /> class with a specified set of <see cref="T:System.Windows.Forms.MenuItem" /> objects.</para>
</summary>
<param name="menuItems">
<attribution license="cc4" from="Microsoft" modified="false" />An array of <see cref="T:System.Windows.Forms.MenuItem" /> objects that represent the menu items to add to the shortcut menu. </param>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Collapse">
<MemberSignature Language="C#" Value="public event EventHandler Collapse;" />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>For more information about handling events, see <format type="text/html"><a href="01e4f1bc-e55e-413f-98c7-6588493e5f67">Consuming Events</a></format>. </para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Occurs when the shortcut menu collapses.</para>
</summary>
</Docs>
</Member>
<Member MemberName="OnCollapse">
<MemberSignature Language="C#" Value="protected virtual void OnCollapse (EventArgs e);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.EventArgs" />
</Parameters>
<Docs>
<remarks>To be added.</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Raises the <see cref="E:System.Windows.Forms.ContextMenu.Collapse" /> event. </para>
</summary>
<param name="e">
<attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.EventArgs" /> that contains the event data.</param>
</Docs>
</Member>
<Member MemberName="OnPopup">
<MemberSignature Language="C#" Value="protected virtual void OnPopup (EventArgs e);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="e" Type="System.EventArgs" />
</Parameters>
<Docs>
<remarks>To be added.</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Raises the <see cref="E:System.Windows.Forms.ContextMenu.Popup" /> event </para>
</summary>
<param name="e">
<attribution license="cc4" from="Microsoft" modified="false" />An <see cref="T:System.EventArgs" /> that contains the event data. </param>
</Docs>
</Member>
<Member MemberName="Popup">
<MemberSignature Language="C#" Value="public event EventHandler Popup;" />
<MemberType>Event</MemberType>
<ReturnValue>
<ReturnType>System.EventHandler</ReturnType>
</ReturnValue>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>You can use this event to initialize the <see cref="T:System.Windows.Forms.MenuItem" /> objects before they are displayed. For example, if you use a <see cref="T:System.Windows.Forms.ContextMenu" /> for three <see cref="T:System.Windows.Forms.TextBox" /> controls and you want to disable certain menu items in the <see cref="T:System.Windows.Forms.ContextMenu" /> depending on which <see cref="T:System.Windows.Forms.TextBox" /> is displaying the shortcut menu, you can create an event handler for this event. You could use the <see cref="P:System.Windows.Forms.ContextMenu.SourceControl" /> property to determine which <see cref="T:System.Windows.Forms.TextBox" /> is about to display the <see cref="T:System.Windows.Forms.ContextMenu" /> and disable the appropriate <see cref="T:System.Windows.Forms.MenuItem" /> objects.</para>
<para>For more information about handling events, see <format type="text/html"><a href="01E4F1BC-E55E-413F-98C7-6588493E5F67">Consuming Events</a></format>.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Occurs before the shortcut menu is displayed.</para>
</summary>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="ProcessCmdKey">
<MemberSignature Language="C#" Value="protected virtual bool ProcessCmdKey (ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData, System.Windows.Forms.Control control);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="msg" Type="System.Windows.Forms.Message&amp;" RefType="ref" />
<Parameter Name="keyData" Type="System.Windows.Forms.Keys" />
<Parameter Name="control" Type="System.Windows.Forms.Control" />
</Parameters>
<Docs>
<param name="msg">To be added.</param>
<param name="keyData">To be added.</param>
<param name="control">To be added.</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="RightToLeft">
<MemberSignature Language="C#" Value="public virtual System.Windows.Forms.RightToLeft RightToLeft { set; get; }" />
<MemberType>Property</MemberType>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DefaultValue(System.Windows.Forms.RightToLeft.No)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Localizable(true)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.RightToLeft</ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This property enables your menus to support languages that are written from right to left. When this property is set to RightToLeft.Yes, the menu item text is displayed from right to left instead of the default left to right method.</para>
<block subset="none" type="note">
<para>For more information about how enabling right-to-left alignment affects Windows Forms controls, see the <see cref="P:System.Windows.Forms.Control.RightToLeft" /> property.</para>
</block>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets or sets a value indicating whether text displayed by the control is displayed from right to left.</para>
</summary>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Show">
<MemberSignature Language="C#" Value="public void Show (System.Windows.Forms.Control control, System.Drawing.Point pos);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="control" Type="System.Windows.Forms.Control" />
<Parameter Name="pos" Type="System.Drawing.Point" />
</Parameters>
<Docs>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Typically, a <see cref="T:System.Windows.Forms.ContextMenu" /> is displayed when the user clicks the right mouse button on a control or area of the form that the <see cref="T:System.Windows.Forms.ContextMenu" /> is bound to. You can use this method to manually display the shortcut menu at a specific location and bind it with a specific control. This method does not return until the menu is dismissed.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Displays the shortcut menu at the specified position.</para>
</summary>
<param name="control">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Windows.Forms.Control" /> that specifies the control with which this shortcut menu is associated. </param>
<param name="pos">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Drawing.Point" /> that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the <paramref name="control" /> parameter. </param>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
<Member MemberName="Show">
<MemberSignature Language="C#" Value="public void Show (System.Windows.Forms.Control control, System.Drawing.Point pos, System.Windows.Forms.LeftRightAlignment alignment);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="control" Type="System.Windows.Forms.Control" />
<Parameter Name="pos" Type="System.Drawing.Point" />
<Parameter Name="alignment" Type="System.Windows.Forms.LeftRightAlignment" />
</Parameters>
<Docs>
<remarks>To be added.</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Displays the shortcut menu at the specified position and with the specified alignment.</para>
</summary>
<param name="control">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Windows.Forms.Control" /> that specifies the control with which this shortcut menu is associated.</param>
<param name="pos">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Drawing.Point" /> that specifies the coordinates at which to display the menu. These coordinates are specified relative to the client coordinates of the control specified in the <paramref name="control" /> parameter.</param>
<param name="alignment">
<attribution license="cc4" from="Microsoft" modified="false" />A <see cref="T:System.Windows.Forms.LeftRightAlignment" /> that specifies the alignment of the control relative to the <paramref name="pos" /> parameter.</param>
</Docs>
</Member>
<Member MemberName="SourceControl">
<MemberSignature Language="C#" Value="public System.Windows.Forms.Control SourceControl { get; }" />
<MemberType>Property</MemberType>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.Control</ReturnType>
</ReturnValue>
<Docs>
<value>To be added.</value>
<remarks>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>This property enables you to determine which control currently displays the shortcut menu defined in the <see cref="T:System.Windows.Forms.ContextMenu" />. If the shortcut menu is not currently displayed, you can use this property to determine which control last displayed the shortcut menu. You can use this property in the <see cref="E:System.Windows.Forms.ContextMenu.Popup" /> event to ensure that the control displays the proper menu items. You can also use this property to pass a reference to the control to a method that performs the tasks associated with a menu command displayed in the shortcut menu. Since the <see cref="T:System.Windows.Forms.Form" /> class inherits from <see cref="T:System.Windows.Forms.Control" />, you can also use this property if the <see cref="T:System.Windows.Forms.ContextMenu" /> is associated with a form.</para>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
<para>Gets the control that is displaying the shortcut menu.</para>
</summary>
</Docs>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
</AssemblyInfo>
</Member>
</Members>
</Type>