CheckedListBox.ObjectCollection 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
에 있는 CheckedListBox항목의 컬렉션을 나타냅니다.
public: ref class CheckedListBox::ObjectCollection : System::Windows::Forms::ListBox::ObjectCollection
public class CheckedListBox.ObjectCollection : System.Windows.Forms.ListBox.ObjectCollection
type CheckedListBox.ObjectCollection = class
inherit ListBox.ObjectCollection
Public Class CheckedListBox.ObjectCollection
Inherits ListBox.ObjectCollection
- 상속
예제
다음 예제에서는 목록의 항목을 열거하고 목록의 CheckedListBox 다른 모든 항목을 확인합니다. 이 예제에서는 속성을 사용하여 Items 항목을 가져오는 CheckedListBox.ObjectCollectionCount 방법을 보여 줍니다.
또한 이 예제에서는 항목의 SetItemCheckState 확인 상태를 설정하기 위해 메서드 및 SetItemChecked 메서드를 사용하는 방법을 보여 줍니다. 검사
void CheckEveryOther_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
// Cycle through every item and check every other.
// Set flag to true to know when this code is being executed. Used in the ItemCheck
// event handler.
insideCheckEveryOther = true;
for ( int i = 0; i < checkedListBox1->Items->Count; i++ )
{
// For every other item in the list, set as checked.
if ( (i % 2) == 0 )
{
// But for each other item that is to be checked, set as being in an
// indeterminate checked state.
if ( (i % 4) == 0 )
checkedListBox1->SetItemCheckState( i, CheckState::Indeterminate );
else
checkedListBox1->SetItemChecked( i, true );
}
}
insideCheckEveryOther = false;
}
private void CheckEveryOther_Click(object sender, System.EventArgs e) {
// Cycle through every item and check every other.
// Set flag to true to know when this code is being executed. Used in the ItemCheck
// event handler.
insideCheckEveryOther = true;
for (int i = 0; i < checkedListBox1.Items.Count; i++) {
// For every other item in the list, set as checked.
if ((i % 2) == 0) {
// But for each other item that is to be checked, set as being in an
// indeterminate checked state.
if ((i % 4) == 0)
checkedListBox1.SetItemCheckState(i, CheckState.Indeterminate);
else
checkedListBox1.SetItemChecked(i, true);
}
}
insideCheckEveryOther = false;
}
Private Sub CheckEveryOther_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckEveryOther.Click
' Cycle through every item and check every other.
Dim i As Integer
' Set flag to true to know when this code is being executed. Used in the ItemCheck
' event handler.
insideCheckEveryOther = True
For i = 0 To CheckedListBox1.Items.Count - 1
' For every other item in the list, set as checked.
If ((i Mod 2) = 0) Then
' But for each other item that is to be checked, set as being in an
' indeterminate checked state.
If ((i Mod 4) = 0) Then
CheckedListBox1.SetItemCheckState(i, CheckState.Indeterminate)
Else
CheckedListBox1.SetItemChecked(i, True)
End If
End If
Next
insideCheckEveryOther = False
End Sub
설명
컬렉션은 부모 컨트롤 CheckedListBox에서 속성에 의해 액세스됩니다 Items . CheckedListBox 컨트롤에 표시할 개체 컬렉션을 만들려면 Add 메서드 및 Remove 메서드를 사용하여 항목을 개별적으로 추가하거나 제거할 수 있습니다.
생성자
| Name | Description |
|---|---|
| CheckedListBox.ObjectCollection(CheckedListBox) |
CheckedListBox.ObjectCollection 클래스의 새 인스턴스를 초기화합니다. |
속성
| Name | Description |
|---|---|
| Count |
컬렉션의 항목 수를 가져옵니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IsReadOnly |
컬렉션이 읽기 전용인지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| Item[Int32] |
컬렉션 내의 지정된 인덱스에서 항목을 가져오거나 설정합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
메서드
| Name | Description |
|---|---|
| Add(Object, Boolean) |
추가할 개체 및 선택 여부를 지정하여 항목의 목록에 항목을 CheckedListBox추가합니다. |
| Add(Object, CheckState) |
추가할 개체와 초기 확인된 값을 지정하여 항목 목록에 항목을 CheckedListBox추가합니다. |
| Add(Object) |
에 대한 항목 목록에 항목을 추가합니다 ListBox. (다음에서 상속됨 ListBox.ObjectCollection) |
| AddRange(ListBox+ObjectCollection) |
에 있는 항목 목록에 기존 ListBox.ObjectCollection 항목을 ListBox추가합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| AddRange(Object[]) |
에 대한 항목 목록에 항목 배열을 ListBox추가합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| Clear() |
컬렉션에서 모든 항목을 제거합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| Contains(Object) |
지정된 항목이 컬렉션 내에 있는지 여부를 확인합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| CopyTo(Object[], Int32) |
전체 컬렉션을 배열 내의 지정된 위치에 있는 개체의 기존 배열에 복사합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| Equals(Object) |
지정된 개체가 현재 개체와 같은지 여부를 확인합니다. (다음에서 상속됨 Object) |
| GetEnumerator() |
항목 컬렉션을 반복하는 데 사용할 열거자를 반환합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| GetHashCode() |
기본 해시 함수로 사용됩니다. (다음에서 상속됨 Object) |
| GetType() |
현재 인스턴스의 Type 가져옵니다. (다음에서 상속됨 Object) |
| IndexOf(Object) |
지정된 항목의 컬렉션 내에서 인덱스 값을 반환합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| Insert(Int32, Object) |
지정된 인덱스의 목록 상자에 항목을 삽입합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| MemberwiseClone() |
현재 Object단순 복사본을 만듭니다. (다음에서 상속됨 Object) |
| Remove(Object) |
컬렉션에서 지정된 개체를 제거합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| RemoveAt(Int32) |
컬렉션 내의 지정된 인덱스에 있는 항목을 제거합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| ToString() |
현재 개체를 나타내는 문자열을 반환합니다. (다음에서 상속됨 Object) |
명시적 인터페이스 구현
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다. 특정 배열 인덱스에서 시작하여 컬렉션의 요소를 배열에 복사합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| ICollection.IsSynchronized |
이 멤버에 대한 설명은 을 참조하세요 IsSynchronized. (다음에서 상속됨 ListBox.ObjectCollection) |
| ICollection.SyncRoot |
이 멤버에 대한 설명은 을 참조하세요 SyncRoot. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.Add(Object) |
이 API는 제품 인프라를 지원하며 코드에서 직접 사용되지 않습니다. 클래스에 개체를 ListBox 추가합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.Contains(Object) |
특정 값이 IList 포함되어 있는지 여부를 확인합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.IndexOf(Object) |
에서 특정 항목의 인덱스를 IList결정합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.Insert(Int32, Object) |
지정된 인덱스에 항목을 IList 삽입합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.IsFixedSize |
이 멤버에 대한 설명은 을 참조하세요 IsFixedSize. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.Item[Int32] |
지정된 인덱스에서 요소를 가져오거나 설정합니다. (다음에서 상속됨 ListBox.ObjectCollection) |
| IList.Remove(Object) |
에서 특정 개체의 첫 번째 항목을 제거합니다 IList. (다음에서 상속됨 ListBox.ObjectCollection) |
확장명 메서드
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
쿼리의 병렬 처리를 사용하도록 설정합니다. |
| AsQueryable(IEnumerable) |
IEnumerable IQueryable변환합니다. |
| Cast<TResult>(IEnumerable) |
IEnumerable 요소를 지정된 형식으로 캐스팅합니다. |
| OfType<TResult>(IEnumerable) |
지정된 형식에 따라 IEnumerable 요소를 필터링합니다. |