SplitContainer.SplitterMoving SplitContainer.SplitterMoving SplitContainer.SplitterMoving SplitContainer.SplitterMoving Event

정의

Splitter 컨트롤을 이동하는 동안 발생합니다.Occurs when the splitter control is in the process of moving.

public:
 event System::Windows::Forms::SplitterCancelEventHandler ^ SplitterMoving;
public event System.Windows.Forms.SplitterCancelEventHandler SplitterMoving;
member this.SplitterMoving : System.Windows.Forms.SplitterCancelEventHandler 
Public Custom Event SplitterMoving As SplitterCancelEventHandler 

예제

다음 코드 예제에서는 발생을 SplitterMoving 이벤트, 분할자를 이동 하면 커서 스타일을 변경 하 여이 예제에 표시 됩니다.The following code example raises the SplitterMoving event, signified in this example by a change to the cursor style when you move the splitter. SplitterMoved 분할자 이동 중지 하면 이벤트가 발생 합니다.The SplitterMoved event is raised when you stop moving the splitter. 기본 커서 스타일으로이 예에서이 표시 됩니다.This is signified in this example by the cursor style reverting to the default.

#using <System.Data.dll>
#using <System.Windows.Forms.dll>
#using <System.dll>
#using <System.Drawing.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Data;
public ref class Form1: public System::Windows::Forms::Form
{
private:
   System::Windows::Forms::SplitContainer^ splitContainer1;

public:

   // Create an empty Windows form.
   Form1()
   {
      InitializeComponent();
   }


private:
   void InitializeComponent()
   {
      splitContainer1 = gcnew System::Windows::Forms::SplitContainer;
      splitContainer1->SuspendLayout();
      SuspendLayout();
      
      // Place a basic SplitContainer control onto Form1.
      splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
      splitContainer1->Location = System::Drawing::Point( 0, 0 );
      splitContainer1->Name = "splitContainer1";
      splitContainer1->Size = System::Drawing::Size( 292, 273 );
      splitContainer1->SplitterDistance = 52;
      splitContainer1->SplitterWidth = 6;
      splitContainer1->TabIndex = 0;
      splitContainer1->Text = "splitContainer1";
      
      // Add the event handler for the SplitterMoved event.
      splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved );
      
      // Add the event handler for the SplitterMoving event.
      splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving );
      
      // This is the left panel of the vertical SplitContainer control.
      splitContainer1->Panel1->Name = "splitterPanel1";
      
      // This is the right panel of the vertical SplitContainer control.
      splitContainer1->Panel2->Name = "splitterPanel2";
      
      // Lay out the basic properties of the form.
      ClientSize = System::Drawing::Size( 292, 273 );
      Controls->Add( splitContainer1 );
      Name = "Form1";
      Text = "Form1";
      splitContainer1->ResumeLayout( false );
      ResumeLayout( false );
   }

   void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ )
   {
      
      // Define what happens when the splitter is no longer moving.
      ::Cursor::Current = System::Windows::Forms::Cursors::Default;
   }

   void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ )
   {
      
      // Define what happens while the splitter is moving.
      ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert;
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew Form1 );
}

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.SplitContainer splitContainer1;

// Create an empty Windows form.
public Form1()
    {
    InitializeComponent();
    }
    private void InitializeComponent()
    {
        splitContainer1 = new System.Windows.Forms.SplitContainer();
        splitContainer1.SuspendLayout();
        SuspendLayout();

        // Place a basic SplitContainer control onto Form1.
        splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
        splitContainer1.Location = new System.Drawing.Point(0, 0);
        splitContainer1.Name = "splitContainer1";
        splitContainer1.Size = new System.Drawing.Size(292, 273);
        splitContainer1.SplitterDistance = 52;
        splitContainer1.SplitterWidth = 6;
        splitContainer1.TabIndex = 0;
        splitContainer1.Text = "splitContainer1";

        // Add the event handler for the SplitterMoved event.
        splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(splitContainer1_SplitterMoved);

        // Add the event handler for the SplitterMoving event.
        splitContainer1.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainer1_SplitterMoving);
 
        // This is the left panel of the vertical SplitContainer control.
        splitContainer1.Panel1.Name = "splitterPanel1";
 
        // This is the right panel of the vertical SplitContainer control.
        splitContainer1.Panel2.Name = "splitterPanel2";

        // Lay out the basic properties of the form.
        ClientSize = new System.Drawing.Size(292, 273);
        Controls.Add(splitContainer1);
        Name = "Form1";
        Text = "Form1";
        splitContainer1.ResumeLayout(false);
        ResumeLayout(false);

    }
    [STAThread]
    static void Main() 
    {
        Application.Run(new Form1());
    }

    private void splitContainer1_SplitterMoved(System.Object sender, System.Windows.Forms.SplitterEventArgs e)
    {
    // Define what happens when the splitter is no longer moving.
    Cursor.Current=System.Windows.Forms.Cursors.Default;
    }

    private void splitContainer1_SplitterMoving(System.Object sender, System.Windows.Forms.SplitterCancelEventArgs e)
    {
    // Define what happens while the splitter is moving.
    Cursor.Current=System.Windows.Forms.Cursors.NoMoveVert;
    }
}
' Compile this example using the following command line:
' vbc splitcontainerevents.vb /r:System.Drawing.dll /r:System.Windows.Forms.dll /r:System.dll /r:System.Data.dll
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data

' Create an empty Windows form.
Public Class Form1
    Inherits System.Windows.Forms.Form
    ' This is the event handler for the SplitterMoving and SplitterMoved events.
    Private WithEvents SplitContainer1 As System.Windows.Forms.SplitContainer

    Public Sub New()
        InitializeComponent()
    End Sub


Private Sub InitializeComponent()
SplitContainer1 = New System.Windows.Forms.SplitContainer
SplitContainer1.SuspendLayout()
SuspendLayout()

' Place a basic SplitContainer control onto Form1.
SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
SplitContainer1.Location = New System.Drawing.Point(0, 0)
SplitContainer1.Name = "SplitContainer1"
SplitContainer1.Size = New System.Drawing.Size(292, 273)
SplitContainer1.SplitterDistance = 39
SplitContainer1.SplitterWidth = 6
SplitContainer1.TabIndex = 0
SplitContainer1.Text = "SplitContainer1"

' This is the left panel of the vertical SplitContainer control.

SplitContainer1.Panel1.Name = "SplitterPanel1"

' This is the right panel of the vertical SplitContainer control.
SplitContainer1.Panel2.Name = "SplitterPanel2"

' Lay out the basic properties of the form.
ClientSize = New System.Drawing.Size(292, 273)
Controls.Add(SplitContainer1)
Name = "Form1"
Text = "Form1"
SplitContainer1.ResumeLayout(False)
ResumeLayout(False)

    End Sub

<STAThread()>  _
Shared Sub Main()
    Application.Run(New Form1())
End Sub

    Private Sub SplitContainer1_SplitterMoving(ByVal sender As Object, ByVal e As System.Windows.Forms.SplitterCancelEventArgs) Handles SplitContainer1.SplitterMoving
        ' Define what happens while the splitter is moving.
        Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert
    End Sub

    Private Sub SplitContainer1_SplitterMoved(ByVal sender As Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer1.SplitterMoved
        ' Define what happens when the splitter is no longer moving.
        Cursor.Current = System.Windows.Forms.Cursors.Default
    End Sub
End Class

설명

이 이벤트는 사용자가 splitter 컨트롤이 이동 하는 경우에 발생 합니다.This event occurs only when the user moves the splitter control. 변경할 때 발생 하지 않습니다는 SplitterDistance 속성을 프로그래밍 방식으로 값입니다.It does not occur when you change the SplitterDistance property value programmatically.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생 을 참조하십시오.For more information about handling events, see Handling and Raising Events.

적용 대상

추가 정보