AnchoringTests DrawControlsAnchoredTogether Method Delta Engine Documentation

Namespace: DeltaEngine.Scenes.Tests.Controls
Assembly: DeltaEngine.Scenes.Tests (in DeltaEngine.Scenes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void DrawControlsAnchoredTogether()
Examples

[Test]
public void DrawControlsAnchoredTogether()
{
    var centerButton = new Button(ButtonDrawArea, "Click Me");
    var rnd = Randomizer.Current;
    centerButton.Clicked +=
        () => centerButton.TopLeft = new Vector2D(rnd.Get(0.3f, 0.6f), rnd.Get(0.3f, 0.6f));
    new Button(ButtonDrawArea) // button left of center button
    {
        RightMargin = new Margin(centerButton, Edge.Left, 0.01f),
        TopMargin = new Margin(centerButton, Edge.Top, 0.0f)
    };
    new Button(ButtonDrawArea) // button right of center button
    {
        LeftMargin = new Margin(centerButton, Edge.Right, 0.01f),
        TopMargin = new Margin(centerButton, Edge.Top, 0.0f)
    };
    new Button(ButtonDrawArea) // button above center button
    {
        BottomMargin = new Margin(centerButton, Edge.Top, 0.01f),
        LeftMargin = new Margin(centerButton, Edge.Left, 0.0f)
    };
    new Button(ButtonDrawArea) // button below center button
    {
        TopMargin = new Margin(centerButton, Edge.Bottom, 0.01f),
        LeftMargin = new Margin(centerButton, Edge.Left, 0.0f)
    };
    centerButton.Click();
}
See Also