DesignerActionMethodItem 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 DesignerActionMethodItem 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| 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);
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.DesignerActionMethodItem
Public Sub New (actionList As DesignerActionList, memberName As String, displayName As String)
參數
- actionList
- DesignerActionList
DesignerActionList那個包含了這個項目所關聯的方法。
- memberName
- String
類別中方法的區分大小寫名稱是從 DesignerActionList to invoke 透過面板項目衍生而來。
- displayName
- String
本件的面板文字。
備註
構造子將 DesignerActionMethodItem 和 Description 屬性設為 null,屬性IncludeAsDesignerVerb設Category為 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);
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.DesignerActionMethodItem
Public Sub New (actionList As DesignerActionList, memberName As String, displayName As String, includeAsDesignerVerb As Boolean)
參數
- actionList
- DesignerActionList
DesignerActionList那個包含了這個項目所關聯的方法。
- memberName
- String
類別中方法的區分大小寫名稱是從 DesignerActionList to invoke 透過面板項目衍生而來。
- displayName
- String
本件的面板文字。
- includeAsDesignerVerb
- Boolean
一個標記,指定是否也將相關方法視為設計動詞。
備註
若 includeAsDesignerVerb 參數設為 true,則此項目也被視為 DesignerVerb;因此會被加入元件的設計時捷徑選單中。 在 Visual Studio 中,屬性窗格也會新增一個指令。 設計動詞列表可透過設計 Verbs 者的集合屬性存取。
建構子將 DesignerActionMethodItem 和 Description 屬性設Category為 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);
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.DesignerActionMethodItem
Public Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String)
參數
- actionList
- DesignerActionList
DesignerActionList那個包含了這個項目所關聯的方法。
- memberName
- String
類別中方法的區分大小寫名稱是從 DesignerActionList to invoke 透過面板項目衍生而來。
- displayName
- String
本件的面板文字。
備註
建構子將 DesignerActionMethodItem 屬性設為 Descriptionnull ,屬性 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);
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.DesignerActionMethodItem
Public Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String, includeAsDesignerVerb As Boolean)
參數
- actionList
- DesignerActionList
DesignerActionList那個包含了這個項目所關聯的方法。
- memberName
- String
類別中方法的區分大小寫名稱是從 DesignerActionList to invoke 透過面板項目衍生而來。
- 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);
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.DesignerActionMethodItem
Public Sub New (actionList As DesignerActionList, memberName As String, displayName As String, category As String, description As String)
參數
- actionList
- DesignerActionList
DesignerActionList那個包含了這個項目所關聯的方法。
- memberName
- String
類別中方法的區分大小寫名稱是從 DesignerActionList to invoke 透過面板項目衍生而來。
- 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);
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.DesignerActionMethodItem
Public 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 to invoke 透過面板項目衍生而來。
- displayName
- String
本件的面板文字。
- description
- String
本項目的補充文字,用於工具提示或狀態欄。
- includeAsDesignerVerb
- Boolean
一個旗標,指定是否也將相關方法視為相關元件的設計動詞。
範例
以下程式碼範例示範如何建立一組 DesignerActionItem 物件。
關於實作智慧標籤的完整範例,請參見 「如何:將智慧標籤附加到視窗表單元件」。
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