Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IExtenderListService Interface

Provides an interface that can list extender providers.

For a list of all members of this type, see IExtenderListService Members.

[Visual Basic]
Public Interface IExtenderListService
[C#]
public interface IExtenderListService
[C++]
public __gc __interface IExtenderListService
[JScript]
public interface IExtenderListService

Remarks

A site can implement this service if it wants to provide a list of extender providers. By default, the list of extenders is generated by querying each component in the container that implements IExtenderProvider for the extenders each provides. By implementing this interface on a component site, a container can override the list of providers.

Example

[Visual Basic, C#, C++] The following example demonstrates using the IExtenderListService to obtain the set of currently active extender providers.

[Visual Basic] 
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.ComponentModel.Design
Imports System.Drawing
Imports System.Data
Imports System.Windows.Forms

' This control lists any active extender providers.
Public Class ExtenderListServiceControl
   Inherits System.Windows.Forms.UserControl
   Private extenderListService As IExtenderListService
   Private extenderNames() As String
   
   Public Sub New()
      extenderNames = New String(-1) {}
      Me.Width = 600
    End Sub

    ' Queries the IExtenderListService when the control is sited 
    ' in design mode.
    Public Overrides Property Site() As System.ComponentModel.ISite
        Get
            Return MyBase.Site
        End Get
        Set(ByVal Value As System.ComponentModel.ISite)
            MyBase.Site = Value
            If Me.DesignMode Then
                extenderListService = CType(Me.GetService(GetType(IExtenderListService)), IExtenderListService)
                If Not (extenderListService Is Nothing) Then
                    Dim extenders As IExtenderProvider() = extenderListService.GetExtenderProviders()
                    extenderNames = New String(extenders.Length) {}
                    Dim i As Integer
                    For i = 0 To extenders.Length - 1
                        Dim types As Type() = Type.GetTypeArray(extenders)
                        extenderNames(i) = "ExtenderProvider #" + i.ToString() + ":  " + types(i).FullName
                    Next i
                End If
            Else
                extenderListService = Nothing
                extenderNames = New String(-1) {}
            End If
        End Set
    End Property

    ' Draws a list of any active extender providers
    Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
        If extenderNames.Length = 0 Then
            e.Graphics.DrawString("No active extender providers", New Font("Arial", 9), New SolidBrush(Color.Black), 10, 10)
        Else
            e.Graphics.DrawString("List of types of active extender providers", New Font("Arial", 9), New SolidBrush(Color.Black), 10, 10)
        End If
        Dim i As Integer
        For i = 0 To extenderNames.Length - 1
            e.Graphics.DrawString(extenderNames(i), New Font("Arial", 8), New SolidBrush(Color.Black), 10, 25 + i * 10)
        Next i
    End Sub

End Class

[C#] 
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace ExtenderListServiceExample
{
    // This control lists any active extender providers.
    public class ExtenderListServiceControl : System.Windows.Forms.UserControl
    {        
        private IExtenderListService extenderListService;
        private string[] extenderNames;

        public ExtenderListServiceControl()
        {            
            extenderNames = new string[0];
            this.Width = 600;
        }

        // Queries the IExtenderListService when the control is sited 
        // in design mode.
        public override System.ComponentModel.ISite Site
        {
            get
            {
                return base.Site;
            }
            set
            {
                base.Site = value;
                if( this.DesignMode )
                {
                    extenderListService = (IExtenderListService)this.GetService(typeof(IExtenderListService));
                    if( extenderListService != null )
                    {
                        IExtenderProvider[] extenders = extenderListService.GetExtenderProviders();
                        extenderNames = new string[extenders.Length];
                        for( int i=0; i<extenders.Length; i++ )
                            extenderNames[i] = "ExtenderProvider #"+i.ToString()+":  "+extenders[i].GetType().FullName;
                    }
                }
                else
                {
                    extenderListService = null;
                    extenderNames = new string[0];
                }
            }
        }

        // Draws a list of any active extender providers
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            if( extenderNames.Length == 0 )
                e.Graphics.DrawString("No active extender providers", new Font("Arial", 9), new SolidBrush(Color.Black), 10, 10);
            else
                e.Graphics.DrawString("List of types of active extender providers", new Font("Arial", 9), new SolidBrush(Color.Black), 10, 10);
            for(int i=0; i<extenderNames.Length; i++)
                e.Graphics.DrawString(extenderNames[i], new Font("Arial", 8), new SolidBrush(Color.Black), 10, 25+(i*10));
        }        
    }
}

[C++] 
#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>

using namespace System;
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::ComponentModel::Design;
using namespace System::Windows::Forms;

namespace ExtenderListServiceExample
{
    // This control lists any active extender providers.
    public __gc class ExtenderListServiceControl : public UserControl {
    private:

        IExtenderListService* extenderListService;
        String* extenderNames[];

    public:

        ExtenderListServiceControl()
        {
            this->Width = 600;
        }

        // Queries the IExtenderListService when the control is sited
        // in design mode.
        __property ISite* get_Site()
        {
            return UserControl::get_Site();
        }

        __property void set_Site(ISite* value)
        {
            UserControl::set_Site( value );
            if( this->DesignMode )
            {
                extenderListService = dynamic_cast<IExtenderListService*>(this->GetService(__typeof(IExtenderListService)));
                if( extenderListService != 0 )
                {
                    IExtenderProvider* extenders[] = extenderListService->GetExtenderProviders();
                    extenderNames = new String*[extenders->Length];
                    for( int i=0; i<extenders->Length; i++ )
                        extenderNames[i] = String::Concat( S"ExtenderProvider #", i.ToString(), S":  ", extenders[i]->GetType()->FullName );
                }
            }
            else
            {
                extenderListService = 0;
            }
        }

    protected:

        // Draws a list of any active extender providers
        void OnPaint(PaintEventArgs* e)
        {
            if( extenderNames->Length == 0 )
                e->Graphics->DrawString(S"No active extender providers", new System::Drawing::Font(S"Arial", 9), new SolidBrush(Color::Black), 10, 10);
            else
                e->Graphics->DrawString(S"List of types of active extender providers", new System::Drawing::Font(S"Arial", 9), new SolidBrush(Color::Black), 10, 10);
            for(int i=0; i<extenderNames->Length; i++)
                e->Graphics->DrawString(extenderNames[i], new System::Drawing::Font(S"Arial", 8), new SolidBrush(Color::Black), 10, 25+(i*10));
        }
    };
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.ComponentModel.Design

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

IExtenderListService Members | System.ComponentModel.Design Namespace | IExtenderProvider

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft