Bagikan melalui


Adorner.Enabled Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan apakah Adorner diaktifkan.

public:
 property bool Enabled { bool get(); void set(bool value); };
public bool Enabled { get; set; }
member this.Enabled : bool with get, set
Public Property Enabled As Boolean

Nilai Properti

true, jika Adorner diaktifkan; jika tidak, false.

Contoh

Contoh kode berikut menunjukkan cara mengaktifkan dan menonaktifkan Adorner. Untuk daftar kode lengkap, lihat Cara: Memperluas Tampilan dan Perilaku Kontrol dalam Mode Desain.

// The AnchorGlyph objects should mimic the resize glyphs;
// they should only be visible when the control is the 
// primary selection. The adorner is enabled when the 
// control is the primary selection and disabled when 
// it is not.

void selectionService_SelectionChanged(object sender, EventArgs e)
{
    if (object.ReferenceEquals(
        this.selectionService.PrimarySelection,
        this.relatedControl))
    {
        this.ComputeBounds();
        this.anchorAdorner.Enabled = true;
    }
    else
    {
        this.anchorAdorner.Enabled = false;
    }
}
' The AnchorGlyph objects should mimic the resize glyphs;
' they should only be visible when the control is the 
' primary selection. The adorner is enabled when the 
' control is the primary selection and disabled when 
' it is not.
Private Sub selectionService_SelectionChanged( _
ByVal sender As Object, _
ByVal e As EventArgs)

    If Object.ReferenceEquals( _
    Me.selectionService.PrimarySelection, _
    Me.relatedControl) Then
        Me.ComputeBounds()
        Me.anchorAdorner.Enabled = True
    Else
        Me.anchorAdorner.Enabled = False
    End If

End Sub

Keterangan

Enabled Jika properti adalah true, BehaviorService kelas akan mengirim HitTest dan Paint mengirim pesan ke Adorner.

Berlaku untuk

Lihat juga