EditorPartCollection コンストラクタ (ICollection)
アセンブリ: System.Web (system.web.dll 内)

- editorParts
EditorPart コントロールの ICollection。

EditorPartCollection コンストラクタは、EditorPartCollection クラスのインスタンスを初期化し、EditorPart コントロールのコレクションを渡します。これは、新しい EditorPartCollection オブジェクトの作成とそれに対する EditorPart コントロールの追加に使用できる、EditorPartCollection コンストラクタのオーバーロードの 1 つです。
コンストラクタによって作成された EditorPartCollection インスタンスが読み取り専用であっても、コレクション内の個別の EditorPart コントロールにプログラムによってアクセスし、そのプロパティおよびメソッドを呼び出すことはできます。
EditorPartCollection コンストラクタは、一般的に、EditorPart コントロールの全体のセットに対して、内容、外観、または関連するコントロール グループの位置の変更などのバッチ操作を行う場合に使用されます。
他に EditorPartCollection コンストラクタは、カスタム EditorPart コントロールの開発でも、このカスタム コントロールをサーバー コントロールに関連付けてユーザーが各自のコントロールのカスタム プロパティを編集できるようにする場合によく使用されます。このシナリオでは、サーバー コントロールは、IWebEditable インターフェイスを実装する必要があります。また、そのタスクの一部として、CreateEditorParts メソッドを実装する必要があります。そのメソッドでは、カスタム EditorPart コントロールでサーバー コントロールを編集できるように、EditorPart コントロールを、ArrayList オブジェクトなどの ICollection インスタンスに追加する必要があります。次に、EditorPart コントロールのコレクションを EditorPartCollection コンストラクタに渡して、新しい EditorPartCollection オブジェクトを作成できます。EditorZoneBase ゾーンは、これを使用してすべてのコントロールを設定し、編集プロセスを開始します。

カスタム EditorPartCollection を作成し、コレクションが読み取り専用の場合でも、コレクション内の個別の EditorPart コントロールを変更するバッチ操作を実行する方法を次のコード例に示します。例の実行に必要なコード全体については、EditorPartCollection クラスの概要で「例」を参照してください。
Button1_Click イベント内のコードは、ArrayList オブジェクトを作成し、ページ内の 3 つの EditorPart コントロールのうち 2 つをオブジェクトに追加します。次に、EditorPartCollection コンストラクタを使用して、新しい EditorPartCollection オブジェクトを作成します。また、コレクションが読み取り専用であっても、基になる EditorPart コントロールを変更できる方法も示します。
<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>
<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>
ブラウザでページを読み込み、[Display Mode] ドロップダウン リスト コントロールの [編集] を選択することにより、ページを編集モードに切り替えることができます。TextDisplayWebPart コントロールのタイトル バーで動詞メニュー (下向きの矢印) をクリックし、[編集] をクリックすることにより、コントロールを編集できます。編集中のユーザー インターフェイス (UI) が表示状態の場合、すべての EditorPart コントロールを表示できます。[Create EditorPartCollection] ボタンをクリックして、EditorPartCollection オブジェクトに追加される 2 つの EditorPart コントロールに対する効果を確認します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EditorPartCollection コンストラクタ (EditorPartCollection, ICollection)
アセンブリ: System.Web (system.web.dll 内)

Dim existingEditorParts As EditorPartCollection Dim editorParts As ICollection Dim instance As New EditorPartCollection(existingEditorParts, editorParts)
public:
EditorPartCollection (
EditorPartCollection^ existingEditorParts,
ICollection^ editorParts
)
public function EditorPartCollection ( existingEditorParts : EditorPartCollection, editorParts : ICollection )

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EditorPartCollection コンストラクタ

名前 | 説明 |
---|---|
EditorPartCollection () | EditorPartCollection クラスの新しい空のインスタンスを初期化します。 |
EditorPartCollection (ICollection) | EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。 |
EditorPartCollection (EditorPartCollection, ICollection) | EditorPart コントロールの EditorPartCollection コレクション、および追加の EditorPart コントロールの ICollection コレクションを渡すことによって、EditorPartCollection クラスの新しいインスタンスを初期化します。 |

関連項目
EditorPartCollection クラスEditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間
その他の技術情報
ASP.NET Web パーツ ページASP.NET Web パーツ ページ
EditorPartCollection コンストラクタ ()
アセンブリ: System.Web (system.web.dll 内)


EditorPartCollection コンストラクタは、EditorPartCollection クラスの空のインスタンスを初期化します。コンストラクタのこのオーバーロードは、EditorZone クラスによってその CreateEditorParts メソッドで内部で使用され、空のコレクション オブジェクトを作成します。次に、ゾーンは、子ゾーン テンプレートで宣言されたすべての EditorPart コントロールのインスタンスを作成し、内部メソッドを使用して、それらをコレクションに追加します。
EditorPartCollection コンストラクタのこのオーバーロードは、EditorPartCollection の新しいインスタンスの作成、およびそれに対する EditorPart コントロールの追加には使用できません。代わりに、EditorPartCollection コンストラクタの他のオーバーロードのいずれかを使用する必要があります。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


EditorPartCollection クラス
EditorPartCollection メンバ
System.Web.UI.WebControls.WebParts 名前空間
その他の技術情報
ASP.NET Web パーツ ページ
ASP.NET Web パーツ ページ
- EditorPartCollection コンストラクタのページへのリンク