SplitterCancelEventArgs.MouseCursorX Właściwość

Definicja

Pobiera współrzędną X wskaźnika myszy we współrzędnych klienta.

public:
 property int MouseCursorX { int get(); };
public int MouseCursorX { get; }
member this.MouseCursorX : int
Public ReadOnly Property MouseCursorX As Integer

Wartość właściwości

Liczba całkowita reprezentująca współrzędną X wskaźnika myszy we współrzędnych klienta.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego elementu członkowskiego. W tym przykładzie program obsługi zdarzeń zgłasza wystąpienie SplitContainer.SplitterMoving zdarzenia. Ten raport pomaga dowiedzieć się, kiedy wystąpi zdarzenie, i może pomóc w debugowaniu. Aby zgłosić wiele zdarzeń lub często występujących zdarzeń, rozważ zastąpienie MessageBox.Show komunikatu ciągiem Console.WriteLine lub dołączenie go do wielowierszowego TextBoxelementu .

Aby uruchomić przykładowy kod, wklej go w projekcie zawierającym wystąpienie typu SplitContainer o nazwie SplitContainer1. Następnie upewnij się, że program obsługi zdarzeń jest skojarzony ze zdarzeniem SplitContainer.SplitterMoving .

private void SplitContainer1_SplitterMoving(Object sender, SplitterCancelEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "MouseCursorX", e.MouseCursorX );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "MouseCursorY", e.MouseCursorY );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SplitX", e.SplitX );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "SplitY", e.SplitY );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "SplitterMoving Event" );
}
Private Sub SplitContainer1_SplitterMoving(sender as Object, e as SplitterCancelEventArgs) _ 
     Handles SplitContainer1.SplitterMoving

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "MouseCursorX", e.MouseCursorX)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "MouseCursorY", e.MouseCursorY)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "SplitX", e.SplitX)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "SplitY", e.SplitY)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"SplitterMoving Event")

End Sub

Dotyczy