通过


DesignerActionPropertyItem 构造函数

定义

初始化 DesignerActionPropertyItem 类的新实例。

重载

名称 说明
DesignerActionPropertyItem(String, String)

使用指定的属性和显示名称初始化类的新实例 DesignerActionPropertyItem

DesignerActionPropertyItem(String, String, String)

使用指定的属性和类别名称初始化类的新实例 DesignerActionPropertyItem ,并显示文本。

DesignerActionPropertyItem(String, String, String, String)

使用指定的属性和类别名称以及显示和说明文本初始化类的新实例 DesignerActionPropertyItem

DesignerActionPropertyItem(String, String)

Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs

使用指定的属性和显示名称初始化类的新实例 DesignerActionPropertyItem

public:
 DesignerActionPropertyItem(System::String ^ memberName, System::String ^ displayName);
public DesignerActionPropertyItem(string memberName, string displayName);
public DesignerActionPropertyItem(string memberName, string? displayName);
new System.ComponentModel.Design.DesignerActionPropertyItem : string * string -> System.ComponentModel.Design.DesignerActionPropertyItem
Public Sub New (memberName As String, displayName As String)

参数

memberName
String

与此面板项关联的属性的区分大小写的名称。

displayName
String

此项的面板文本。

注解

构造DesignerActionPropertyItem(String, String)函数将和Description属性设置为 Categorynull.

memberName 参数引用关联属性的名称,该属性是派生自 DesignerActionList 该类的程序员提供的类的成员。

另请参阅

适用于

DesignerActionPropertyItem(String, String, String)

Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs

使用指定的属性和类别名称初始化类的新实例 DesignerActionPropertyItem ,并显示文本。

public:
 DesignerActionPropertyItem(System::String ^ memberName, System::String ^ displayName, System::String ^ category);
public DesignerActionPropertyItem(string memberName, string displayName, string category);
public DesignerActionPropertyItem(string memberName, string? displayName, string? category);
new System.ComponentModel.Design.DesignerActionPropertyItem : string * string * string -> System.ComponentModel.Design.DesignerActionPropertyItem
Public Sub New (memberName As String, displayName As String, category As String)

参数

memberName
String

与此面板项关联的属性的区分大小写的名称。

displayName
String

此项的面板文本。

category
String

用于对面板上的类似项进行分组的区分 String 大小写。

注解

构造 DesignerActionPropertyItem(String, String, String) 函数将 Description 属性设置为 null.

有关如何使用参数对面板上的项进行分组的详细信息 category ,请参阅该方法 GetSortedActionItems

memberName 参数引用关联属性的名称,该属性是派生自 DesignerActionList的程序员提供的类的成员。

另请参阅

适用于

DesignerActionPropertyItem(String, String, String, String)

Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs
Source:
DesignerActionPropertyItem.cs

使用指定的属性和类别名称以及显示和说明文本初始化类的新实例 DesignerActionPropertyItem

public:
 DesignerActionPropertyItem(System::String ^ memberName, System::String ^ displayName, System::String ^ category, System::String ^ description);
public DesignerActionPropertyItem(string memberName, string displayName, string category, string description);
public DesignerActionPropertyItem(string memberName, string? displayName, string? category, string? description);
new System.ComponentModel.Design.DesignerActionPropertyItem : string * string * string * string -> System.ComponentModel.Design.DesignerActionPropertyItem
Public Sub New (memberName As String, displayName As String, category As String, description As String)

参数

memberName
String

与此面板项关联的属性的区分大小写的名称。

displayName
String

此项的面板文本。

category
String

用于对面板上的类似项进行分组的区分 String 大小写。

description
String

此工具提示或状态栏中使用的此项的补充文本。

示例

下面的代码示例演示如何创建对象的集合 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

注解

有关如何使用参数对面板上的项进行分组的详细信息 category ,请参阅该方法 GetSortedActionItems

memberName 参数引用关联属性的名称,该属性是派生自 DesignerActionList 该类的程序员提供的类的成员。

另请参阅

适用于