DesignerActionList.AutoShow Propriété

Définition

Obtient ou définit une valeur qui indique si le panneau des balises actives doit être affiché automatiquement lorsqu'il est créé.

C#
public virtual bool AutoShow { get; set; }

Valeur de propriété

true si le panneau doit être affiché lorsque le composant propriétaire est créé ; sinon, false. La valeur par défaut est false.

Exemples

L’exemple de code suivant montre comment créer une collection d’objets DesignerActionItem .

Pour obtenir une explication complète de cet exemple de code, consultez Guide pratique pour attacher des balises actives à un composant Windows Forms.

C#
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;
}

Remarques

Si la valeur de la propriété est définie sur true, le composant auquel il DesignerActionList est associé se développe automatiquement et affiche le panneau de balise active lors de la création du composant.

Vous pouvez refuser ce comportement en définissant la DesignerOptions.ObjectBoundSmartTagAutoShow propriété sur false.

S’applique à

Produit Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Voir aussi