本文整理汇总了C#中System.ComponentModel.Design.IExtenderListService接口的典型用法代码示例。如果您正苦于以下问题:C# IExtenderListService接口的具体用法?C# IExtenderListService怎么用?C# IExtenderListService使用的例子?那么恭喜您, 这里精选的接口代码示例或许可以为您提供帮助。
IExtenderListService接口属于System.ComponentModel.Design命名空间,在下文中一共展示了IExtenderListService接口的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtenderListServiceControl
//引入命名空间
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));
}
}
}