EditorPartCollection 생성자

정의

EditorPartCollection 클래스의 새 인스턴스를 초기화합니다.

오버로드

Name Description
EditorPartCollection()

클래스의 빈 새 인스턴스를 초기화합니다 EditorPartCollection .

EditorPartCollection(ICollection)

컨트롤 컬렉션을 전달하여 클래스의 EditorPartCollectionICollection 새 인스턴스를 EditorPart 초기화합니다.

EditorPartCollection(EditorPartCollection, ICollection)

컨트롤 컬렉션과 추가 EditorPartCollection 컨트롤 컬렉션을 EditorPartCollection 전달 EditorPart 하여 클래스의 ICollection 새 인스턴스를 EditorPart 초기화합니다.

EditorPartCollection()

클래스의 빈 새 인스턴스를 초기화합니다 EditorPartCollection .

public:
 EditorPartCollection();
public EditorPartCollection();
Public Sub New ()

설명

EditorPartCollection 생성자는 클래스의 빈 인스턴스를 초기화합니다EditorPartCollection. 생성자의 이 오버로드는 메서드의 EditorZone 클래스에서 CreateEditorParts 내부적으로 빈 컬렉션 개체를 만드는 데 사용됩니다. 그런 다음, 영역은 자식 영역 템플릿에 선언된 모든 EditorPart 컨트롤의 인스턴스를 만들고 내부 메서드를 사용하여 컬렉션에 추가합니다.

생성자의 이 오버로드를 EditorPartCollection 사용하여 새 인스턴스 EditorPartCollection 를 만들고 컨트롤을 추가할 EditorPart 수 없습니다. 대신 생성자에 대한 EditorPartCollection 다른 오버로드 중 하나를 사용해야 합니다.

추가 정보

적용 대상

EditorPartCollection(ICollection)

컨트롤 컬렉션을 전달하여 클래스의 EditorPartCollectionICollection 새 인스턴스를 EditorPart 초기화합니다.

public:
 EditorPartCollection(System::Collections::ICollection ^ editorParts);
public EditorPartCollection(System.Collections.ICollection editorParts);
new System.Web.UI.WebControls.WebParts.EditorPartCollection : System.Collections.ICollection -> System.Web.UI.WebControls.WebParts.EditorPartCollection
Public Sub New (editorParts As ICollection)

매개 변수

editorParts
ICollection

ICollection 컨트롤입니다EditorPart.

예제

다음 코드 예제에서는 사용자 지정 EditorPartCollection 을 만드는 방법을 보여 줍니다. 컬렉션은 읽기 전용이더라도 컬렉션의 개별 EditorPart 컨트롤을 변경 하는 일괄 처리 작업을 수행 합니다. 예제를 실행하는 데 필요한 전체 코드는 클래스 개요의 예제 섹션을 EditorPartCollection 참조하세요.

이벤트의 코드 Button1_Click 는 개체를 ArrayList 만들고, 페이지의 세 EditorPart 컨트롤 중 두 개의 컨트롤을 개체에 추가한 다음, 생성자를 사용하여 새 EditorPartCollection 개체를 EditorPartCollection 만듭니다. 또한 컬렉션이 읽기 전용인 경우에도 기본 컨트롤을 EditorPart 변경하는 방법을 보여 줍니다.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  protected void Button1_Click(object sender, EventArgs e)
  {
    ArrayList list = new ArrayList(2);
    list.Add(AppearanceEditorPart1);
    list.Add(PropertyGridEditorPart1);
    // Pass an ICollection object to the constructor.
    EditorPartCollection myParts = new EditorPartCollection(list);
    foreach (EditorPart editor in myParts)
    {
      editor.BackColor = System.Drawing.Color.LightBlue;
      editor.Description = "My " + editor.DisplayTitle + " editor.";
    }

    // Use the IndexOf property to locate an EditorPart control.
    int propertyGridPart = myParts.IndexOf(PropertyGridEditorPart1);
    myParts[propertyGridPart].ChromeType = PartChromeType.TitleOnly;

    // Use the Contains method to see if an EditorPart exists.
    if(!myParts.Contains(LayoutEditorPart1))
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow;
    
    // Use the CopyTo method to create an array of EditorParts.
    EditorPart[] partArray = new EditorPart[3];
    partArray[0] = LayoutEditorPart1;
    myParts.CopyTo(partArray,1);
    Label1.Text = "<h3>EditorParts in Custom Array</h3>";
    foreach (EditorPart ePart in partArray)
    {
      Label1.Text += ePart.Title + "<br />";
    }

  }

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  Protected Sub Button1_Click(ByVal sender As Object, _
    ByVal e As EventArgs)
    
    Dim list As New ArrayList(2)
    list.Add(AppearanceEditorPart1)
    list.Add(PropertyGridEditorPart1)
    ' Pass an ICollection object to the constructor.
    Dim myParts As New EditorPartCollection(list)
    Dim editor As EditorPart
    For Each editor In myParts
      editor.BackColor = System.Drawing.Color.LightBlue
      editor.Description = "My " + editor.DisplayTitle + " editor."
    Next editor
    
    ' Use the IndexOf property to locate an EditorPart control.
    Dim propertyGridPart As Integer = _
      myParts.IndexOf(PropertyGridEditorPart1)
    myParts(propertyGridPart).ChromeType = PartChromeType.TitleOnly
    
    ' Use the Contains method to see if an EditorPart exists.
    If Not myParts.Contains(LayoutEditorPart1) Then
      LayoutEditorPart1.BackColor = System.Drawing.Color.LightYellow
    End If
    
    ' Use the CopyTo method to create an array of EditorParts.
    Dim partArray(2) As EditorPart
    partArray(0) = LayoutEditorPart1
    myParts.CopyTo(partArray, 1)
    Label1.Text = "<h3>EditorParts in Custom Array</h3>"
    Dim ePart As EditorPart
    For Each ePart In partArray
      Label1.Text += ePart.Title + "<br />"
    Next ePart

  End Sub

</script>

표시 모드 드롭다운 목록 컨트롤에서 편집 을 선택하여 브라우저에서 페이지를 로드하고 페이지를 편집 모드 로 전환할 수 있습니다. 컨트롤의 제목 표시 TextDisplayWebPart 줄에서 동사 메뉴(아래쪽 화살표)를 클릭하고 편집 을 클릭하여 컨트롤을 편집할 수 있습니다. 편집용 UI(사용자 인터페이스)가 표시되면 모든 컨트롤을 EditorPart 볼 수 있습니다. EditorPartCollection 만들기 단추를 클릭하여 개체에 추가 EditorPart 된 두 EditorPartCollection 컨트롤에 미치는 영향을 확인합니다.

설명

EditorPartCollection 생성자는 클래스의 인스턴스를 EditorPartCollection 초기화하고 컨트롤 컬렉션을 EditorPart 전달합니다. 새 개체를 만들고 컨트롤을 EditorPartCollection 추가하는 EditorPartCollection 데 사용할 수 있는 EditorPart 생성자의 오버로드 중 하나입니다.

EditorPartCollection 생성자가 만든 인스턴스는 읽기 전용이지만 컬렉션의 개별 EditorPart 컨트롤에 프로그래밍 방식으로 액세스하고 해당 속성 및 메서드를 호출할 수 있습니다.

생성자를 사용하는 EditorPartCollection 일반적인 시나리오 중 하나는 전체 컨트롤 집합 EditorPart 에서 관련 그룹의 콘텐츠, 모양 또는 위치 변경과 같은 일괄 처리 작업을 수행하려는 경우입니다.

생성자를 사용하는 EditorPartCollection 또 다른 일반적인 시나리오는 사용자가 컨트롤에서 사용자 지정 EditorPart 속성을 편집할 수 있도록 서버 컨트롤과 연결하려는 사용자 지정 컨트롤을 개발하는 것입니다. 이 시나리오에서 서버 컨트롤은 인터페이스를 IWebEditable 구현해야 하며, 해당 작업의 일부로 메서드를 CreateEditorParts 구현해야 합니다. 이 메서드에서 사용자 지정 EditorPart 컨트롤이 서버 컨트롤을 편집할 수 있도록 하려면 개체와 같은 인스턴스에 EditorPart 컨트롤을 ICollection 추가 ArrayList 해야 합니다. 그런 다음 컨트롤 컬렉션을 EditorPart 생성자에 전달하여 EditorPartCollection 영역이 모든 컨트롤을 설정하고 편집 프로세스를 시작하는 데 사용하는 새 EditorPartCollection 개체 EditorZoneBase 를 만들 수 있습니다.

추가 정보

적용 대상

EditorPartCollection(EditorPartCollection, ICollection)

컨트롤 컬렉션과 추가 EditorPartCollection 컨트롤 컬렉션을 EditorPartCollection 전달 EditorPart 하여 클래스의 ICollection 새 인스턴스를 EditorPart 초기화합니다.

public:
 EditorPartCollection(System::Web::UI::WebControls::WebParts::EditorPartCollection ^ existingEditorParts, System::Collections::ICollection ^ editorParts);
public EditorPartCollection(System.Web.UI.WebControls.WebParts.EditorPartCollection existingEditorParts, System.Collections.ICollection editorParts);
new System.Web.UI.WebControls.WebParts.EditorPartCollection : System.Web.UI.WebControls.WebParts.EditorPartCollection * System.Collections.ICollection -> System.Web.UI.WebControls.WebParts.EditorPartCollection
Public Sub New (existingEditorParts As EditorPartCollection, editorParts As ICollection)

매개 변수

existingEditorParts
EditorPartCollection

ICollection 영역의 기존 EditorPart 컨트롤입니다.

editorParts
ICollection

ICollection EditorPart 영역에 없는 컨트롤이지만 프로그래밍 방식으로 만든 컨트롤입니다.

추가 정보

적용 대상