当前位置: 首页>>代码示例>>VB.NET>>正文


VB.NET IExtenderListService接口代码示例

本文整理汇总了VB.NET中System.ComponentModel.Design.IExtenderListService接口的典型用法代码示例。如果您正苦于以下问题:VB.NET IExtenderListService接口的具体用法?VB.NET IExtenderListService怎么用?VB.NET IExtenderListService使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。


在下文中一共展示了IExtenderListService接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。

示例1: ExtenderListServiceControl

' 导入命名空间
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 (extenderListService IsNot 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
开发者ID:VB.NET开发者,项目名称:System.ComponentModel.Design,代码行数:59,代码来源:IExtenderListService


注:本文中的System.ComponentModel.Design.IExtenderListService接口示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。