共用方式為


IAdornerPlacement 介面

更新:2007 年 11 月

會指定 AdornerPlacementCollection 的定位詞彙。

命名空間:  Microsoft.Windows.Design.Interaction
組件:  Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)

語法

Public Interface IAdornerPlacement

Dim instance As IAdornerPlacement
public interface IAdornerPlacement
public interface class IAdornerPlacement
public interface IAdornerPlacement

備註

定位詞彙是用來建立一組值,這組值可供彈性化調整 AdornerPanel 上裝飾項的位置和大小。

範例

在下列程式碼範例中,會說明如何設定滑軌裝飾項在控制項中的定位。如需詳細資訊,請參閱逐步解說:在控制項中實作滑軌

' Place the slider in the adorner panel.
Dim placement As New AdornerPlacementCollection()
AdornerPanel.SetHorizontalStretch(skewSlider, AdornerStretch.Stretch)
AdornerPanel.SetVerticalStretch(skewSlider, AdornerStretch.None)

' Use layout space for the adorner panel.
' If render space were used, the slider would skew along with the button.
panel.CoordinateSpace = AdornerCoordinateSpaces.Layout

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

' Center the adorner within the control.
placement.PositionRelativeToAdornerWidth(0.5, 0)

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

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

AdornerPanel.SetPlacements(skewSlider, placement)
// Place the slider in the adorner panel.
AdornerPlacementCollection placement = new AdornerPlacementCollection();
AdornerPanel.SetHorizontalStretch(skewSlider, AdornerStretch.Stretch);
AdornerPanel.SetVerticalStretch(skewSlider, AdornerStretch.None);

// Use layout space for the adorner panel.
// If render space were used, the slider would skew along with the button.
panel.CoordinateSpace = AdornerCoordinateSpaces.Layout;

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

// Center the adorner within the control.
placement.PositionRelativeToAdornerWidth(0.5, 0);

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

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

AdornerPanel.SetPlacements(skewSlider, placement);

請參閱

參考

IAdornerPlacement 成員

Microsoft.Windows.Design.Interaction 命名空間

AdornerPlacementCollection

AdornerPanel

其他資源

配置空間和轉譯空間

逐步解說:在控制項中實作滑軌

了解 WPF 設計工具擴充性