DesignerActionMethodItem 构造函数   
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 DesignerActionMethodItem 类的新实例。
重载
| DesignerActionMethodItem(DesignerActionList, String, String) | 使用指定的方法和显示名称初始化 DesignerActionMethodItem 类的新实例。 | 
| DesignerActionMethodItem(DesignerActionList, String, String, Boolean) | 使用指定的方法和显示名称以及一个标志(用于指示此项是否应显示在其他用户界面上下文中),初始化 DesignerActionMethodItem 类的新实例。 | 
| DesignerActionMethodItem(DesignerActionList, String, String, String) | 使用指定的方法名称、显示名称和类别名称,初始化 DesignerActionMethodItem 类的新实例。 | 
| DesignerActionMethodItem(DesignerActionList, String, String, String, Boolean) | 使用指定的方法名称、显示名称和类别名称,以及指示此项是否应显示在其他用户界面上下文中的标志,初始化 DesignerActionMethodItem 类的新实例。 | 
| DesignerActionMethodItem(DesignerActionList, String, String, String, String) | 使用指定的方法、类别名称以及显示和说明文本,初始化 DesignerActionMethodItem 类的新实例。 | 
| DesignerActionMethodItem(DesignerActionList, String, String, String, String, Boolean) | 使用指定的方法和类别名称、显示和说明文本,以及指示此项是否应显示在其他用户界面上下文中的标志,初始化 DesignerActionMethodItem 类的新实例。 | 
DesignerActionMethodItem(DesignerActionList, String, String)
使用指定的方法和显示名称初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
注解
构造 DesignerActionMethodItem 函数将 Category 和 Description 属性设置为 null,并将 IncludeAsDesignerVerb 属性设置为 false。
另请参阅
适用于
DesignerActionMethodItem(DesignerActionList, String, String, Boolean)
使用指定的方法和显示名称以及一个标志(用于指示此项是否应显示在其他用户界面上下文中),初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName, bool includeAsDesignerVerb);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName, bool includeAsDesignerVerb);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string * bool -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String, includeAsDesignerVerb As Boolean)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
- includeAsDesignerVerb
- Boolean
一个标志,指定是否也将关联方法处理为设计器谓词。
注解
如果 参数 includeAsDesignerVerb 设置为 true,则此项也被视为 ; DesignerVerb因此,它将添加到组件的设计时快捷菜单。 在 Visual Studio 中,命令还将添加到“属性”窗口的“ 属性 ”窗格中。 可以通过设计器的集合属性访问设计器 Verbs 谓词列表。
构造 DesignerActionMethodItem 函数将 Category 和 Description 属性设置为 null。
另请参阅
适用于
DesignerActionMethodItem(DesignerActionList, String, String, String)
使用指定的方法名称、显示名称和类别名称,初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName, System::String ^ category);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName, string category);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string * string -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
注解
构造 DesignerActionMethodItem 函数将 Description 属性设置为 null ,将 IncludeAsDesignerVerb 属性设置为 false。
有关如何 category 使用 参数对面板上的项进行分组的详细信息,请参阅 GetSortedActionItems 方法。
另请参阅
适用于
DesignerActionMethodItem(DesignerActionList, String, String, String, Boolean)
使用指定的方法名称、显示名称和类别名称,以及指示此项是否应显示在其他用户界面上下文中的标志,初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName, System::String ^ category, bool includeAsDesignerVerb);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName, string category, bool includeAsDesignerVerb);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string * string * bool -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String, includeAsDesignerVerb As Boolean)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
- includeAsDesignerVerb
- Boolean
一个标志,指定是否也将关联方法视为关联组件的设计器谓词。
注解
如果 参数 includeAsDesignerVerb 设置为 true,则该项也被视为 ; DesignerVerb因此,它将添加到组件的设计时快捷菜单。 可以通过设计器的集合属性访问设计器 Verbs 谓词列表。
构造 DesignerActionMethodItem 函数将 Description 属性设置为 null。
有关如何 category 使用 参数对面板上的项进行分组的详细信息,请参阅 GetSortedActionItems 方法。
另请参阅
适用于
DesignerActionMethodItem(DesignerActionList, String, String, String, String)
使用指定的方法、类别名称以及显示和说明文本,初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName, System::String ^ category, System::String ^ description);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName, string category, string description);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string * string * string -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String, description As String)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
- description
- String
此项的补充文本,用在工具提示或状态栏中。
注解
构造 DesignerActionMethodItem 函数将 IncludeAsDesignerVerb 属性设置为 false。
有关如何 category 使用 参数对面板上的项进行分组的详细信息,请参阅 GetSortedActionItems 方法。
另请参阅
适用于
DesignerActionMethodItem(DesignerActionList, String, String, String, String, Boolean)
使用指定的方法和类别名称、显示和说明文本,以及指示此项是否应显示在其他用户界面上下文中的标志,初始化 DesignerActionMethodItem 类的新实例。
public:
 DesignerActionMethodItem(System::ComponentModel::Design::DesignerActionList ^ actionList, System::String ^ memberName, System::String ^ displayName, System::String ^ category, System::String ^ description, bool includeAsDesignerVerb);public DesignerActionMethodItem (System.ComponentModel.Design.DesignerActionList actionList, string memberName, string displayName, string category, string description, bool includeAsDesignerVerb);new System.ComponentModel.Design.DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionList * string * string * string * string * bool -> System.ComponentModel.Design.DesignerActionMethodItemPublic Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String, description As String, includeAsDesignerVerb As Boolean)参数
- actionList
- DesignerActionList
DesignerActionList,包含与此项关联的方法。
- memberName
- String
要通过面板项调用的方法的名称,此方法是从 DesignerActionList 派生的类中的一个方法,其方法名区分大小写。
- displayName
- String
此项的面板文本。
- description
- String
此项的补充文本,用在工具提示或状态栏中。
- includeAsDesignerVerb
- Boolean
一个标志,指定是否也将关联方法视为关联组件的设计器谓词。
示例
下面的代码示例演示如何创建 对象的集合 DesignerActionItem 。
有关实现智能标记的完整示例,请参阅 如何:将智能标记附加到 Windows 窗体组件。
public override DesignerActionItemCollection GetSortedActionItems()
{
    DesignerActionItemCollection items = new DesignerActionItemCollection();
    //Define static section header entries.
    items.Add(new DesignerActionHeaderItem("Appearance"));
    items.Add(new DesignerActionHeaderItem("Information"));
    //Boolean property for locking color selections.
    items.Add(new DesignerActionPropertyItem("LockColors",
                     "Lock Colors", "Appearance",
                     "Locks the color properties."));
    if (!LockColors)
    {
        items.Add(new DesignerActionPropertyItem("BackColor",
                         "Back Color", "Appearance",
                         "Selects the background color."));
        items.Add(new DesignerActionPropertyItem("ForeColor",
                         "Fore Color", "Appearance",
                         "Selects the foreground color."));
        //This next method item is also added to the context menu 
        // (as a designer verb).
        items.Add(new DesignerActionMethodItem(this,
                         "InvertColors", "Invert Colors",
                         "Appearance",
                         "Inverts the fore and background colors.",
                          true));
    }
    items.Add(new DesignerActionPropertyItem("Text",
                     "Text String", "Appearance",
                     "Sets the display text."));
    //Create entries for static Information section.
    StringBuilder location = new StringBuilder("Location: ");
    location.Append(colLabel.Location);
    StringBuilder size = new StringBuilder("Size: ");
    size.Append(colLabel.Size);
    items.Add(new DesignerActionTextItem(location.ToString(),
                     "Information"));
    items.Add(new DesignerActionTextItem(size.ToString(),
                     "Information"));
    return items;
}
Public Overrides Function GetSortedActionItems() _
As DesignerActionItemCollection
    Dim items As New DesignerActionItemCollection()
    'Define static section header entries.
    items.Add(New DesignerActionHeaderItem("Appearance"))
    items.Add(New DesignerActionHeaderItem("Information"))
    'Boolean property for locking color selections.
    items.Add(New DesignerActionPropertyItem( _
    "LockColors", _
    "Lock Colors", _
    "Appearance", _
    "Locks the color properties."))
    If Not LockColors Then
        items.Add( _
        New DesignerActionPropertyItem( _
        "BackColor", _
        "Back Color", _
        "Appearance", _
        "Selects the background color."))
        items.Add( _
        New DesignerActionPropertyItem( _
        "ForeColor", _
        "Fore Color", _
        "Appearance", _
        "Selects the foreground color."))
        'This next method item is also added to the context menu 
        ' (as a designer verb).
        items.Add( _
        New DesignerActionMethodItem( _
        Me, _
        "InvertColors", _
        "Invert Colors", _
        "Appearance", _
        "Inverts the fore and background colors.", _
        True))
    End If
    items.Add( _
    New DesignerActionPropertyItem( _
    "Text", _
    "Text String", _
    "Appearance", _
    "Sets the display text."))
    'Create entries for static Information section.
    Dim location As New StringBuilder("Location: ")
    location.Append(colLabel.Location)
    Dim size As New StringBuilder("Size: ")
    size.Append(colLabel.Size)
    items.Add( _
    New DesignerActionTextItem( _
    location.ToString(), _
    "Information"))
    items.Add( _
    New DesignerActionTextItem( _
    size.ToString(), _
    "Information"))
    Return items
End Function
注解
如果 参数 includeAsDesignerVerb 设置为 true,则此项也被视为 ; DesignerVerb因此,它将添加到组件的设计时快捷菜单。 可以通过设计器的集合属性访问设计器 Verbs 谓词列表。
有关如何 category 使用 参数对面板上的项进行分组的详细信息,请参阅 GetSortedActionItems 方法。