DesignerActionMethodItem Klass

Definition

Representerar ett smart taggpanelobjekt som är associerat med en metod i en klass som härleds från DesignerActionList.

public ref class DesignerActionMethodItem : System::ComponentModel::Design::DesignerActionItem
public class DesignerActionMethodItem : System.ComponentModel.Design.DesignerActionItem
type DesignerActionMethodItem = class
    inherit DesignerActionItem
Public Class DesignerActionMethodItem
Inherits DesignerActionItem
Arv
DesignerActionMethodItem

Exempel

Följande kodexempel visar hur du skapar en samling DesignerActionItem objekt.

Ett fullständigt exempel på hur du implementerar smarta taggar finns i How to: Attach Smart Tags to a Windows Forms Component.

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

Kommentarer

Klassen DesignerActionMethodItem representerar enskilda objekt i en panel med smarta taggar. Ett objekt av den här typen visas som ett aktivt användargränssnittselement, till exempel en hyperlänk, som anropar en metod som tillhandahålls av programmeraren i en klass som härletts från DesignerActionList. Associationen mellan objektet och metoden underhålls via värdet för MemberName egenskapen. Den metod som det här objektet anropar får varken ta parametrar eller returnera ett värde.

Enskilda panelobjekt associeras tillsammans för att bilda en panel genom ett anrop till GetSortedActionItems klassens DesignerActionList metod.

Konstruktorer

Name Description
DesignerActionMethodItem(DesignerActionList, String, String, Boolean)

Initierar en ny instans av DesignerActionMethodItem klassen, med den angivna metoden och visningsnamnen, och en flagga som anger om objektet ska visas i andra användargränssnittskontexter.

DesignerActionMethodItem(DesignerActionList, String, String, String, Boolean)

Initierar en ny instans av DesignerActionMethodItem klassen med den angivna metoden, visnings- och kategorinamnen och en flagga som anger om objektet ska visas i andra användargränssnittskontexter.

DesignerActionMethodItem(DesignerActionList, String, String, String, String, Boolean)

Initierar en ny instans av DesignerActionMethodItem klassen med angivna metod- och kategorinamn, visnings- och beskrivningstext och en flagga som anger om objektet ska visas i andra användargränssnittskontexter.

DesignerActionMethodItem(DesignerActionList, String, String, String, String)

Initierar en ny instans av DesignerActionMethodItem klassen med angivna metod- och kategorinamn samt visnings- och beskrivningstext.

DesignerActionMethodItem(DesignerActionList, String, String, String)

Initierar en ny instans av DesignerActionMethodItem klassen med den angivna metoden, visnings- och kategorinamnen.

DesignerActionMethodItem(DesignerActionList, String, String)

Initierar en ny instans av DesignerActionMethodItem klassen med den angivna metoden och visningsnamn.

Egenskaper

Name Description
AllowAssociate

Hämtar eller anger ett värde som anger om objektet ska placeras i en grupp med objekt som har samma Category egenskapsvärde.

(Ärvd från DesignerActionItem)
Category

Hämtar gruppnamnet för ett objekt.

(Ärvd från DesignerActionItem)
Description

Hämtar den kompletterande texten för objektet.

(Ärvd från DesignerActionItem)
DisplayName

Hämtar texten för det här objektet.

(Ärvd från DesignerActionItem)
IncludeAsDesignerVerb

Hämtar ett värde som anger DesignerActionMethodItem att ska visas i andra användargränssnittskontexter.

MemberName

Hämtar namnet på den metod som detta DesignerActionMethodItem är associerat med.

Properties

Hämtar en referens till en samling som kan användas för att lagra programmerade nyckel/värde-par.

(Ärvd från DesignerActionItem)
RelatedComponent

Hämtar eller anger en komponent som bidrar med dess DesignerActionMethodItem objekt till den aktuella panelen.

ShowInSourceView

Hämtar eller anger ett värde som anger om det här objektet visas i källkodsvyn.

(Ärvd från DesignerActionItem)

Metoder

Name Description
Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
Invoke()

Kör programmatiskt den metod som är associerad med DesignerActionMethodItem.

MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Gäller för

Se även