SplitterEventArgs.SplitX 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 (客戶端座標)左上角 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.Show訊息替換Console.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該類別的性質,來判斷當 和 SplitterMoved 事件被提出時SplitterMoving控制項的位置Splitter。