Поделиться через


AdornerPanel.SetPlacements - метод

Обновлен: Ноябрь 2007

Задает значение вложенного свойства зависимостей 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 имеет значение nullссылка null (Nothing в Visual Basic).

Примеры

В следующем примере кода демонстрируется использование метода 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 - пространство имен

Другие ресурсы

Архитектура графического элемента

Пространство макета и пространство визуализации

Поставщики функций и соединительные элементы