FlowDirection 枚举

定义

定义指定方向的常数,连续的用户界面 (UI) 元素将按照该方向放入线性布局容器中。

public enum class FlowDirection
public enum FlowDirection
type FlowDirection = 
Public Enum FlowDirection
继承
FlowDirection

字段

BottomUp 3

元素从设计图面的底部流到顶部。

LeftToRight 0

元素从设计图面的左边缘流到右边缘。

RightToLeft 2

元素从设计图面的右边缘流到左边缘。

TopDown 1

元素从设计图面的顶部流到底部。

示例

以下示例演示如何在控件上FlowLayoutPanel设置 FlowDirection 属性。 此代码示例是为控件提供的更大示例的 FlowLayoutPanel 一部分。

private:
    void flowTopDownBtn_CheckedChanged(System::Object^ sender,
        System::EventArgs^ e)
    {
        this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown;
    }

private:
    void flowBottomUpBtn_CheckedChanged(System::Object^ sender,
        System::EventArgs^ e)
    {
        this->flowLayoutPanel1->FlowDirection = FlowDirection::BottomUp;
    }

private:
    void flowLeftToRight_CheckedChanged(System::Object^ sender,
        System::EventArgs^ e)
    {
        this->flowLayoutPanel1->FlowDirection =
            FlowDirection::LeftToRight;
    }

private:
    void flowRightToLeftBtn_CheckedChanged(
        System::Object^ sender, System::EventArgs^ e)
    {
        this->flowLayoutPanel1->FlowDirection =
            FlowDirection::RightToLeft;
    }
private void flowTopDownBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.FlowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
}

private void flowBottomUpBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.FlowLayoutPanel1.FlowDirection = FlowDirection.BottomUp;
}

private void flowLeftToRight_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.FlowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
}

private void flowRightToLeftBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.FlowLayoutPanel1.FlowDirection = FlowDirection.RightToLeft;
}
Private Sub flowTopDownBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles flowTopDownBtn.CheckedChanged

    Me.FlowLayoutPanel1.FlowDirection = FlowDirection.TopDown

End Sub

Private Sub flowBottomUpBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles flowBottomUpBtn.CheckedChanged

    Me.FlowLayoutPanel1.FlowDirection = FlowDirection.BottomUp

End Sub

Private Sub flowLeftToRight_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles flowLeftToRight.CheckedChanged

    Me.FlowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight

End Sub

Private Sub flowRightToLeftBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles flowRightToLeftBtn.CheckedChanged

    Me.FlowLayoutPanel1.FlowDirection = FlowDirection.RightToLeft

End Sub

注解

枚举 FlowDirection 描述设计图面或容器(如窗体)上连续 UI 元素(通常是控件)的流动方向。 此枚举由线性布局容器(如 FlowLayoutPanel)使用,后者在 属性内部 FlowLayoutPanel.FlowDirection 存储此信息。

确定 FlowDirection 将新控件添加到支持容器时默认放置的位置。 容器的流动方向以及 Anchor 每个包含控件的 和 Dock 属性决定了控件在调整容器大小时对控件的重新排列。

控件 FlowLayoutPanel 为其子控件提供 FlowBreak 属性。 将 FlowBreak 属性的值设置为 true 会使 FlowLayoutPanel 控件停止按当前排列方向对控件进行布局,并换行到下一行或下一列。

适用于

另请参阅