Adorner.Enabled 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,指出是否啟用 Adorner。
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
屬性值
如果已啟用 Adorner 則為 true
,否則為 false
。
範例
下列程式代碼範例示範如何啟用和停用 Adorner。 如需完整的程式代碼清單,請參閱 如何:擴充設計模式中控件的外觀和行為。
// 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
備註
Enabled如果 屬性為 true
,類別BehaviorService會將 和 Paint
訊息傳送HitTest
至 Adorner。