BehaviorService.Adorners Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Namespace:   System.Windows.Forms.Design.Behavior
Assembly:  System.Design (in System.Design.dll)

public BehaviorServiceAdornerCollection Adorners { get; }

The Adorners property provides access to the BehaviorServiceAdornerCollection managed by the BehaviorService.

The following code example demonstrates how to add Adorner objects to and remove them from a BehaviorServiceAdornerCollection. This code example is part of a larger example provided for the BehaviorService class.

class MyDesigner : ControlDesigner
{
    private Adorner myAdorner;

    protected override void Dispose(bool disposing)
    {
        if (disposing && myAdorner != null)
        {
            BehaviorService b = BehaviorService;
            if (b != null)
            {
                b.Adorners.Remove(myAdorner);
            }
        }
    }

    public override void Initialize(IComponent component)
    {
        base.Initialize(component);

        // Add the custom set of glyphs using the BehaviorService. 
        // Glyphs live on adornders.
        myAdorner = new Adorner();
        BehaviorService.Adorners.Add(myAdorner);
        myAdorner.Glyphs.Add(new MyGlyph(BehaviorService, Control));
    }
}

.NET Framework
Available since 2.0
Return to top
Show: