[SplitterContainer][Tips] 分割方向を設定する

スポンサーリンク

SplitterContainerコントロールは、Orientationプロパティの値を変更することで分割方向を設定することができます。

Orientationプロパティには、Orientation列挙体の値を設定します。

Orientation列挙体
メンバ名 説明
Vertival 垂直方向
Horizontal 水平方向

下記は、分割方向を設定する例です。

選択されたラジオボタンの内容に合わせて分割方向を設定します。

VBの例

' 「分割方向」ラジオボタンのチェック変更時の処理
Private Sub rdoOrientation_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoVertical.CheckedChanged, rdoHorizontal.CheckedChanged
    If rdoVertical.Checked = True Then
        '★★★分割方向を垂直に設定★★★
        SplitContainer1.Orientation = Orientation.Vertical
    Else
        '★★★分割方向を水平に設定★★★
        SplitContainer1.Orientation = Orientation.Horizontal
    End If
End Sub

C#の例

// 「分割方向」ラジオボタンのチェック変更時の処理
private void rdoOrientation_CheckedChanged(object sender, EventArgs e)
{
    if (rdoVertical.Checked == true)
    {
        // ★★★分割方向を垂直に設定★★★
        splitContainer1.Orientation = Orientation.Vertical;
    }
    else
    {
        // ★★★分割方向を水平に設定★★★
        splitContainer1.Orientation = Orientation.Horizontal;
    }
}
Please follow and like us:

コメント

タイトルとURLをコピーしました