Control.ControlCollection.Remove(Control) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤 컬렉션에서 지정된 컨트롤을 제거합니다.
public:
virtual void Remove(System::Windows::Forms::Control ^ value);
public virtual void Remove(System.Windows.Forms.Control value);
public virtual void Remove(System.Windows.Forms.Control? value);
abstract member Remove : System.Windows.Forms.Control -> unit
override this.Remove : System.Windows.Forms.Control -> unit
Public Overridable Sub Remove (value As Control)
매개 변수
- value
- Control
Control 에서 제거할 항목입니다Control.ControlCollection.
예제
다음 코드 예제에서는 ControlControl.ControlCollection 컬렉션의 멤버인 경우 파생 클래스 Panel 에서 제거 합니다. 이 예제에서는 에 대해 하나 Panel이상의 Button 컨트롤을 만들어야 RadioButton합니다Form. 컨트롤이 RadioButton 컨트롤에 Panel 추가되고 컨트롤이 Panel 에 추가 Form됩니다. 단추를 클릭하면 이름이 지정된 radioButton2 라디오 단추가 제거 Control.ControlCollection됩니다.
// Remove the RadioButton control if it exists.
private:
void removeButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
if ( panel1->Controls->Contains( removeButton ) )
{
panel1->Controls->Remove( removeButton );
}
}
// Remove the RadioButton control if it exists.
private void removeButton_Click(object sender, System.EventArgs e)
{
if(panel1.Controls.Contains(removeButton))
{
panel1.Controls.Remove(removeButton);
}
}
' Remove the RadioButton control if it exists.
Private Sub RemoveButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RemoveButton.Click
If Panel1.Controls.Contains(RemoveButton) Then
Panel1.Controls.Remove(RemoveButton)
End If
End Sub
설명
Control 컨트롤 컬렉션에서 제거 되는 경우 모든 후속 컨트롤 컬렉션에서 한 위치 위로 이동 됩니다.
메서드를 Control 사용하여 제거하거나 메서드를 RemoveAt 사용하여 Clear 모든 컨트롤을 제거할 수도 있습니다.
컬렉션에 새 Control 개체를 추가하려면 해당 개체 또는 Add 메서드를 AddRange 사용합니다.
상속자 참고
파생 클래스에서 재정 Remove(Control) 의하는 경우 기본 클래스의 Remove(Control) 메서드를 호출하여 컨트롤이 컬렉션에서 제거되었는지 확인해야 합니다.