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类将向 发送 HitTest
和 Paint
消息Adorner。