You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
namespace Mesnac.Controls.Intake.Base
{
public class StringListConverterParent:TypeConverter
{
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
List<string> list = new List<string>();
list.Add(String.Empty); //添加一个空项
System.ComponentModel.Design.IDesignerHost host = context.GetService(typeof(System.ComponentModel.Design.IDesignerHost)) as System.ComponentModel.Design.IDesignerHost;
foreach (Component cmp in host.Container.Components)
{
if (cmp is IntakeControl)
{
list.Add(cmp.Site.Name);
}
}
return new TypeConverter.StandardValuesCollection(list);
}
}
}