本文整理汇总了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