PowerTools MultiRow for Windows Forms 8.0J
SplitMode プロパティ
使用例 

GcMultiRowコントロールの分割方法を示す値を取得または設定します。
構文
Public Property SplitMode As SplitMode
public SplitMode SplitMode {get; set;}

プロパティ値

GcMultiRowコントロールの分割方法を示すSplitMode値の1つ。既定値はSplitMode.Bothです。
例外
例外解説
System.ComponentModel.InvalidEnumArgumentException指定された値がSplitMode値の1つではありません。
解説
GcMultiRowコントロールは、水平スクロールバーまたは垂直スクロールバーの端にある分割線をドラッグすることで、多数のビューポートに分割表示できます。
使用例
次のサンプルコードは、分割機能の使用方法を示します。ここでは、UIによる分割の有効化/無効化、コードによるビューポートの追加と削除、分割線の外観の変更を行っています。
using System;
using System.Drawing;
using System.Windows.Forms;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class SplitDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private FlowLayoutPanel panel = new FlowLayoutPanel();

        public SplitDemo()
        {
            this.Text = "Multi-Viewports Demo";
            this.Size = new Size(570, 350);

            // Initial flow layout panel and add to form.
            this.panel.Dock = DockStyle.Left;
            this.panel.Size = new Size(300, 200);
            this.panel.FlowDirection = FlowDirection.TopDown;
            this.panel.WrapContents = false;
            this.panel.Padding = new Padding(5);
            this.Controls.Add(panel);

            // Add MultiRow to form
            this.gcMultiRow1.Dock = DockStyle.Left;
            this.gcMultiRow1.Width = 300;
            this.Controls.Add(this.gcMultiRow1);

            // Tip label
            Label label = new Label();
            label.Height = 20;
            label.Dock = DockStyle.Bottom;
            label.BackColor = SystemColors.Info;
            label.Text = "Yow can try to click buttons or drag split line or drag split button to create or remove viewports.";
            this.Controls.Add(label);

            this.Load += new EventHandler(Form1_Load);

            InitButton();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            gcMultiRow1.Template = Template.CreateGridTemplate(10);
            gcMultiRow1.RowCount = 30;

            // Initialize cell value for MultiRow control.
            for (int i = 0; i < gcMultiRow1.RowCount; i++)
            {
                gcMultiRow1.SetValue(i, "textBoxCell1", i);
            }
        }

        #region Button Event Handlers

        void setSplitModeButton_Click(object sender, EventArgs e)
        {
            if (this.gcMultiRow1.SplitMode == SplitMode.Both)
            {
                // Disable UI split.
                this.gcMultiRow1.SplitMode = SplitMode.None;
            }
            else
            {
                // Enable UI split.
                this.gcMultiRow1.SplitMode = SplitMode.Both;
            }
        }

        void addViewportButton_Click(object sender, EventArgs e)
        {
            this.gcMultiRow1.AddViewport(0, -1);
        }

        void removeViewportButton_Click(object sender, EventArgs e)
        {
            if (this.gcMultiRow1.GetVerticalViewportCount() > 1)
            {
                this.gcMultiRow1.RemoveSplit(0, Orientation.Horizontal);
            }
            else
            {
                MessageBox.Show("There is no horizontal split line.");
            }
        }

        void addViewportInSpecificPositionButton_Click(object sender, EventArgs e)
        {
            this.gcMultiRow1.InsertSplit(150, Orientation.Horizontal);
        }

        void changeSplitLineStyleButton_Click(object sender, EventArgs e)
        {
            SplitStyle splitStyle = this.gcMultiRow1.SplitStyle;

            if (this.gcMultiRow1.SplitStyle.BackColor == SystemColors.Control)
            {
                splitStyle.BackColor = Color.FromArgb(255, 215, 230, 247);
                splitStyle.DarkColor = Color.FromArgb(255, 104, 140, 175);
                splitStyle.LightColor = Color.FromArgb(255, 255, 255, 255);
                splitStyle.Width = 7;
            }
            else
            {
                splitStyle.BackColor = SystemColors.Control;
                splitStyle.DarkColor = SystemColors.ControlDark;
                splitStyle.LightColor = SystemColors.ControlLight;
                splitStyle.Width = 6;
            }

            this.gcMultiRow1.SplitStyle = splitStyle;
        }

        void getViewportInfoButton_Click(object sender, EventArgs e)
        {
            string viewportInfo = "Vertical viewport count: " + this.gcMultiRow1.GetVerticalViewportCount();

            viewportInfo += "\r\n";

            viewportInfo += "Horizontal viewport count: " + this.gcMultiRow1.GetHorizontalViewportCount();

            MessageBox.Show(viewportInfo);
        }

        #endregion

        #region Initialize Buttons

        private void InitButton()
        {
            AddButton(setSplitModeButton, "Disable/Enable UI split", new EventHandler(setSplitModeButton_Click));
            AddButton(addViewportButton, "Add a new viewport by code", new EventHandler(addViewportButton_Click));
            AddButton(removeViewportButton, "Remove a split line by code", new EventHandler(removeViewportButton_Click));
            AddButton(addViewportInSpecificPositionButton, "Insert a split line in specific position by code", new EventHandler(addViewportInSpecificPositionButton_Click));
            AddButton(changeSplitLineStyleButton, "Change split line style", new EventHandler(changeSplitLineStyleButton_Click));
            AddButton(getViewportInfoButton, "Get viewport information", new EventHandler(getViewportInfoButton_Click));
        }

        private void AddButton(Button button, string text, EventHandler eventHandler)
        {
            this.panel.Controls.Add(button);
            button.Text = text;
            button.AutoSize = true;
            button.Click += eventHandler;
        }

        Button setSplitModeButton = new Button();
        Button addViewportButton = new Button();
        Button removeViewportButton = new Button();
        Button addViewportInSpecificPositionButton = new Button();
        Button changeSplitLineStyleButton = new Button();
        Button getViewportInfoButton = new Button();

        #endregion

        [STAThreadAttribute()]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new SplitDemo());
        }
    }
}
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Imports GrapeCity.Win.MultiRow

Public Class SplitDemo
    Inherits Form
    Private gcMultiRow1 As New GcMultiRow()
    Private panel As New FlowLayoutPanel()

    Public Sub New()
        Me.Text = "Multi-Viewports Demo"
        Me.Size = New Size(570, 350)

        ' Initial flow layout panel and add to form.
        Me.panel.Dock = DockStyle.Left
        Me.panel.Size = New Size(300, 200)
        Me.panel.FlowDirection = FlowDirection.TopDown
        Me.panel.WrapContents = False
        Me.panel.Padding = New Padding(5)
        Me.Controls.Add(panel)

        ' Add MultiRow to form
        Me.gcMultiRow1.Dock = DockStyle.Left
        Me.gcMultiRow1.Width = 300
        Me.Controls.Add(Me.gcMultiRow1)

        ' Tip label
        Dim label As New Label()
        label.Height = 20
        label.Dock = DockStyle.Bottom
        label.BackColor = SystemColors.Info
        label.Text = "Yow can try to click buttons or drag split line or drag split button to create or remove viewports."
        Me.Controls.Add(label)
        InitButton()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        gcMultiRow1.Template = Template.CreateGridTemplate(10)
        gcMultiRow1.RowCount = 30

        ' Initialize cell value for MultiRow control.
        For i As Integer = 0 To gcMultiRow1.RowCount - 1
            gcMultiRow1.SetValue(i, "textBoxCell1", i)
        Next
    End Sub

#Region "Button Event Handlers"

    Private Sub setSplitModeButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setSplitModeButton.Click
        If Me.gcMultiRow1.SplitMode = SplitMode.Both Then
            ' Disable UI split.
            Me.gcMultiRow1.SplitMode = SplitMode.None
        Else
            ' Enable UI split.
            Me.gcMultiRow1.SplitMode = SplitMode.Both
        End If
    End Sub

    Private Sub addViewportButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles addViewportButton.Click
        Me.gcMultiRow1.AddViewport(0, -1)
    End Sub

    Private Sub removeViewportButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles removeViewportButton.Click
        If Me.gcMultiRow1.GetVerticalViewportCount() > 1 Then
            Me.gcMultiRow1.RemoveSplit(0, Orientation.Horizontal)
        Else
            MessageBox.Show("There is no horizontal split line.")
        End If
    End Sub

    Private Sub addViewportInSpecificPositionButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles addViewportInSpecificPositionButton.Click
        Me.gcMultiRow1.InsertSplit(150, Orientation.Horizontal)
    End Sub

    Private Sub changeSplitLineStyleButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles changeSplitLineStyleButton.Click
        Dim splitStyle As SplitStyle = Me.gcMultiRow1.SplitStyle

        If Me.gcMultiRow1.SplitStyle.BackColor = SystemColors.Control Then
            splitStyle.BackColor = Color.FromArgb(255, 215, 230, 247)
            splitStyle.DarkColor = Color.FromArgb(255, 104, 140, 175)
            splitStyle.LightColor = Color.FromArgb(255, 255, 255, 255)
            splitStyle.Width = 7
        Else
            splitStyle.BackColor = SystemColors.Control
            splitStyle.DarkColor = SystemColors.ControlDark
            splitStyle.LightColor = SystemColors.ControlLight
            splitStyle.Width = 6
        End If

        Me.gcMultiRow1.SplitStyle = splitStyle
    End Sub

    Private Sub getViewportInfoButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles getViewportInfoButton.Click
        Dim viewportInfo As String = "Vertical viewport count: " + Me.gcMultiRow1.GetVerticalViewportCount().ToString()

        viewportInfo += vbCr & vbLf

        viewportInfo += "Horizontal viewport count: " + Me.gcMultiRow1.GetHorizontalViewportCount().ToString()

        MessageBox.Show(viewportInfo)
    End Sub

#End Region

#Region "Initialize Buttons"

    Private Sub InitButton()
        AddButton(setSplitModeButton, "Disable/Enable UI split")
        AddButton(addViewportButton, "Add a new viewport by code")
        AddButton(removeViewportButton, "Remove a split line by code")
        AddButton(addViewportInSpecificPositionButton, "Insert a split line in specific position by code")
        AddButton(changeSplitLineStyleButton, "Change split line style")
        AddButton(getViewportInfoButton, "Get viewport information")
    End Sub

    Private Sub AddButton(ByVal button As Button, ByVal text As String)
        Me.panel.Controls.Add(button)
        button.Text = text
        button.AutoSize = True
    End Sub

    Friend WithEvents setSplitModeButton As New Button()
    Friend WithEvents addViewportButton As New Button()
    Friend WithEvents removeViewportButton As New Button()
    Friend WithEvents addViewportInSpecificPositionButton As New Button()
    Friend WithEvents changeSplitLineStyleButton As New Button()
    Friend WithEvents getViewportInfoButton As New Button()

#End Region

    <STAThreadAttribute()> _
    Public Shared Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New SplitDemo())
    End Sub
End Class
参照

GcMultiRow クラス
GcMultiRow メンバ
SplitStyle プロパティ
SplitOffice2007Style プロパティ

 

 


© 2008-2015 GrapeCity inc. All rights reserved.