Aracılığıyla paylaş


BehaviorService.Adorners Özellik

Tanım

public:
 property System::Windows::Forms::Design::Behavior::BehaviorServiceAdornerCollection ^ Adorners { System::Windows::Forms::Design::Behavior::BehaviorServiceAdornerCollection ^ get(); };
public System.Windows.Forms.Design.Behavior.BehaviorServiceAdornerCollection Adorners { get; }
member this.Adorners : System.Windows.Forms.Design.Behavior.BehaviorServiceAdornerCollection
Public ReadOnly Property Adorners As BehaviorServiceAdornerCollection

Özellik Değeri

Bir donatıcı koleksiyonu.

Örnekler

Aşağıdaki kod örneği, nesnelerin öğesine nasıl ekleneceğini Adorner ve bunlardan BehaviorServiceAdornerCollectionnasıl kaldırılacağını gösterir. Bu kod örneği, sınıfı için BehaviorService sağlanan daha büyük bir örneğin parçasıdır.

public ref class DemoDesigner : public ControlDesigner
{
private:
    Adorner^ demoAdorner;

protected:
    ~DemoDesigner()
    {
        if (demoAdorner != nullptr)
        {
            System::Windows::Forms::Design::Behavior::BehaviorService^ b = 
                this->BehaviorService;
            if (b != nullptr)
            {
                b->Adorners->Remove(demoAdorner);
            }
        }
    }

public:
    virtual void Initialize(IComponent^ component) override
    {
        __super::Initialize(component);

        // Get a hold of the behavior service and add our own set
        // of glyphs.  Glyphs live on adorners.
        demoAdorner = gcnew Adorner();
        BehaviorService->Adorners->Add(demoAdorner);
        demoAdorner->Glyphs->Add 
            (gcnew DemoGlyph(BehaviorService, Control));
    }
};
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));
    }
}
Class MyDesigner
    Inherits ControlDesigner
    Private myAdorner As Adorner


    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso (myAdorner IsNot Nothing) Then
            Dim b As System.Windows.Forms.Design.Behavior.BehaviorService _
                = BehaviorService
            If (b IsNot Nothing) Then
                b.Adorners.Remove(myAdorner)
            End If
        End If

    End Sub


    Public Overrides Sub Initialize(ByVal component As IComponent)
        MyBase.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))

    End Sub
End Class

Açıklamalar

Adorners özelliği tarafından BehaviorServiceyönetilen öğesine BehaviorServiceAdornerCollection erişim sağlar.

Şunlara uygulanır

Ayrıca bkz.