TextBoxBase.BeginChange 메서드

정의

변경 블록을 시작합니다.

public:
 void BeginChange();
public void BeginChange ();
member this.BeginChange : unit -> unit
Public Sub BeginChange ()

예제

다음 예제에서는 및 메서드를 BeginChange EndChange 사용하여 변경 블록을 만드는 방법을 보여 줍니다.

TextBox myTextBox = new TextBox();

// Begin the change block. Once BeginChange() is called
// no text content or selection change events will be raised 
// until EndChange is called. Also, all edits made within
// a BeginChange/EndChange block are wraped in a single undo block.
myTextBox.BeginChange();

// Put some initial text in the TextBox.
myTextBox.Text = "Initial text in TextBox";

// Make other changes if desired...

// Whenever BeginChange() is called EndChange() must also be
// called to end the change block.
myTextBox.EndChange();
Dim myTextBox As New TextBox()

' Begin the change block. Once BeginChange() is called
' no text content or selection change events will be raised 
' until EndChange is called. Also, all edits made within
' a BeginChange/EndChange block are wraped in a single undo block.
myTextBox.BeginChange()

' Put some initial text in the TextBox.
myTextBox.Text = "Initial text in TextBox"

' Make other changes if desired...

' Whenever BeginChange() is called EndChange() must also be
' called to end the change block.
myTextBox.EndChange()

설명

참고

호출 BeginChange할 때 변경 블록을 완료하기 위해 호출 EndChange 해야 합니다. 그렇지 않으면 예외가 throw됩니다.

변경 블록은 논리적으로 여러 변경 내용을 단일 실행 취소 단위로 그룹화하고 텍스트 콘텐츠 또는 선택 변경 이벤트가 변경 블록 이후까지 발생하지 않도록 합니다. 이렇게 하면 텍스트 요소가 다른 수신기에 의해 동시에 변경될 위험 없이 텍스트 요소를 여러 번 편집할 수 있습니다. 메서드를 호출하여 변경 블록을 만듭니다 DeclareChangeBlock . 메서드를 BeginChange 호출하면 메서드에 대한 해당 호출이 이루어질 때까지 모든 후속 변경 내용이 지정된 변경 블록에 EndChange 포함됩니다.

적용 대상

추가 정보