本文整理汇总了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));
}
}
}
开发者ID:.NET开发者,项目名称:System.ComponentModel.Design,代码行数:65,代码来源:IExtenderListService
注:本文中的System.ComponentModel.Design.IExtenderListService接口示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论