次の方法で共有


SplitterEventArgs.SplitX プロパティ

定義

Splitterの左上隅の x 座標を取得または設定します (クライアント座標)。

public:
 property int SplitX { int get(); void set(int value); };
public int SplitX { get; set; }
member this.SplitX : int with get, set
Public Property SplitX As Integer

プロパティ値

コントロールの左上隅の x 座標。

次のコード例は、このメンバーの使用方法を示しています。 この例では、イベント ハンドラーは、 SplitContainer.SplitterMoved イベントの発生を報告します。 このレポートは、イベントがいつ発生するかを学習するのに役立ち、デバッグに役立ちます。 複数のイベントや頻繁に発生するイベントについて報告するには、 MessageBox.ShowConsole.WriteLine に置き換えるか、メッセージを複数行の TextBoxに追加することを検討してください。

コード例を実行するには、SplitContainerという名前の型のインスタンスを含むプロジェクトSplitContainer1貼り付けます。 次に、イベント ハンドラーが SplitContainer.SplitterMoved イベントに関連付けられていることを確認します。

private void SplitContainer1_SplitterMoved(Object sender, SplitterEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "X", e.X );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Y", e.Y );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SplitX", e.SplitX );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SplitY", e.SplitY );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "SplitterMoved Event" );
}
Private Sub SplitContainer1_SplitterMoved(sender as Object, e as SplitterEventArgs) _ 
     Handles SplitContainer1.SplitterMoved

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "X", e.X)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Y", e.Y)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "SplitX", e.SplitX)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "SplitY", e.SplitY)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"SplitterMoved Event")

End Sub

注釈

このプロパティをこのクラスの SplitY プロパティと共に使用して、SplitterMovingイベントとSplitterMoved イベントが発生したときのSplitter コントロールの位置を決定できます。

適用対象

こちらもご覧ください