AdornerPanel.SetPlacements 方法

更新:2007 年 11 月

设置所提供元素的 Placements 附加属性的值。

命名空间:  Microsoft.Windows.Design.Interaction
程序集:  Microsoft.Windows.Design.Interaction(在 Microsoft.Windows.Design.Interaction.dll 中)

语法

声明
Public Shared Sub SetPlacements ( _
    adorner As UIElement, _
    value As AdornerPlacementCollection _
)
用法
Dim adorner As UIElement
Dim value As AdornerPlacementCollection

AdornerPanel.SetPlacements(adorner, value)
public static void SetPlacements(
    UIElement adorner,
    AdornerPlacementCollection value
)
public:
static void SetPlacements(
    UIElement^ adorner, 
    AdornerPlacementCollection^ value
)
public static function SetPlacements(
    adorner : UIElement, 
    value : AdornerPlacementCollection
)

参数

异常

异常 条件
ArgumentNullException

adorner 为 nullnull 引用(在 Visual Basic 中为 Nothing)。

示例

下面的代码示例演示如何使用 SetPlacements 方法指定某个装饰器在装饰器面板中的位置。有关更多信息,请参见 演练:创建设计时装饰器

Dim placement As New AdornerPlacementCollection()

' The adorner's width is relative to the content.
' The slider extends the full width of the control it adorns.
placement.SizeRelativeToContentWidth(1.0, 0)

' The adorner's height is the same as the slider's.
placement.SizeRelativeToAdornerDesiredHeight(1.0, 0)

' Position the adorner above the control it adorns.
placement.PositionRelativeToAdornerHeight(-1.0, 0)

' Position the adorner up 5 pixels. This demonstrates 
' that these placement calls are additive. These two calls
' are equivalent to the following single call:
' PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5)

AdornerPanel.SetPlacements(opacitySlider, placement)
AdornerPlacementCollection placement = new AdornerPlacementCollection();

// The adorner's width is relative to the content.
// The slider extends the full width of the control it adorns.
placement.SizeRelativeToContentWidth(1.0, 0);

// The adorner's height is the same as the slider's.
placement.SizeRelativeToAdornerDesiredHeight(1.0, 0);

// Position the adorner above the control it adorns.
placement.PositionRelativeToAdornerHeight(-1.0, 0);

// Position the adorner up 5 pixels. This demonstrates 
// that these placement calls are additive. These two calls
// are equivalent to the following single call:
// PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5);

AdornerPanel.SetPlacements(opacitySlider, placement);

权限

另请参见

参考

AdornerPanel 类

AdornerPanel 成员

Microsoft.Windows.Design.Interaction 命名空间

其他资源

装饰器体系结构

布局空间和呈现空间

功能提供程序和功能连接器