TypeDescriptor.GetEditor 方法
定义
使用指定的基类型返回编辑器。Returns an editor with the specified base type.
重载
| GetEditor(Object, Type) |
获取指定组件的具有指定基类型的编辑器。Gets an editor with the specified base type for the specified component. |
| GetEditor(Type, Type) |
返回具有指定基类型的指定类型的编辑器。Returns an editor with the specified base type for the specified type. |
| GetEditor(Object, Type, Boolean) |
为指定组件返回具有指定基类型和自定义类型描述符的编辑器。Returns an editor with the specified base type and with a custom type descriptor for the specified component. |
GetEditor(Object, Type)
获取指定组件的具有指定基类型的编辑器。Gets an editor with the specified base type for the specified component.
public:
static System::Object ^ GetEditor(System::Object ^ component, Type ^ editorBaseType);
public static object GetEditor (object component, Type editorBaseType);
static member GetEditor : obj * Type -> obj
Public Shared Function GetEditor (component As Object, editorBaseType As Type) As Object
参数
- component
- Object
要为其获取编辑器的组件。The component to get the editor for.
- editorBaseType
- Type
表示要查找的编辑器的基类型的 Type。A Type that represents the base type of the editor you want to find.
返回
可转换为指定编辑器类型的编辑器的一个实例,如果找不到请求类型的编辑器,则为 null。An instance of the editor that can be cast to the specified editor type, or null if no editor of the requested type can be found.
例外
component 或 editorBaseType 为 null。component or editorBaseType is null.
component 是一个跨进程进行远程处理的对象。component is a cross-process remoted object.
注解
的类型 editorBaseType 通常为 UITypeEditor ,但也可以使用其他类型 (例如 ComponentEditor 和 InstanceCreationEditor) 。The type of editorBaseType is usually UITypeEditor, but you can also use other types (for example, ComponentEditor and InstanceCreationEditor).
可以为一个属性定义多个编辑器。You can define multiple editors for a property. 您可以使用此方法来选择要使用的编辑器。You use this method to select the editor you want to use.
另请参阅
适用于
GetEditor(Type, Type)
返回具有指定基类型的指定类型的编辑器。Returns an editor with the specified base type for the specified type.
public:
static System::Object ^ GetEditor(Type ^ type, Type ^ editorBaseType);
public static object GetEditor (Type type, Type editorBaseType);
static member GetEditor : Type * Type -> obj
Public Shared Function GetEditor (type As Type, editorBaseType As Type) As Object
参数
- editorBaseType
- Type
表示要查找的编辑器的基类型的 Type。A Type that represents the base type of the editor you are trying to find.
返回
可转换为指定基类型的编辑器对象的一个实例,如果找不到请求类型的编辑器,则为 null。An instance of the editor object that can be cast to the given base type, or null if no editor of the requested type can be found.
例外
type 或 editorBaseType 为 null。type or editorBaseType is null.
注解
的类型 editorBaseType 通常为 UITypeEditor ,但也可以使用其他类型 (例如 ComponentEditor 和 InstanceCreationEditor) 。The type of editorBaseType is usually UITypeEditor, but you can also use other types (for example ComponentEditor and InstanceCreationEditor).
可以为一个类型定义多个编辑器。You can define multiple editors for a type. 您可以使用此方法来选择要使用的方法。You use this method to select the one you want to use.
仅当没有对象的实例时,才调用此方法的此版本。Call this version of this method only when you do not have an instance of the object.
另请参阅
适用于
GetEditor(Object, Type, Boolean)
为指定组件返回具有指定基类型和自定义类型描述符的编辑器。Returns an editor with the specified base type and with a custom type descriptor for the specified component.
public:
static System::Object ^ GetEditor(System::Object ^ component, Type ^ editorBaseType, bool noCustomTypeDesc);
public static object GetEditor (object component, Type editorBaseType, bool noCustomTypeDesc);
static member GetEditor : obj * Type * bool -> obj
Public Shared Function GetEditor (component As Object, editorBaseType As Type, noCustomTypeDesc As Boolean) As Object
参数
- component
- Object
要为其获取编辑器的组件。The component to get the editor for.
- editorBaseType
- Type
表示要查找的编辑器的基类型的 Type。A Type that represents the base type of the editor you want to find.
- noCustomTypeDesc
- Boolean
表示是否应考虑自定义类型描述信息的标志。A flag indicating whether custom type description information should be considered.
返回
可转换为指定编辑器类型的编辑器的一个实例,如果找不到请求类型的编辑器,则为 null。An instance of the editor that can be cast to the specified editor type, or null if no editor of the requested type can be found.
例外
component 或 editorBaseType 为 null。component or editorBaseType is null.
component 是一个跨进程进行远程处理的对象。component is a cross-process remoted object.
注解
的类型 editorBaseType 通常为 UITypeEditor ,但也可以使用其他类型 (例如 ComponentEditor 和 InstanceCreationEditor) 。The type of editorBaseType is usually UITypeEditor, but you can also use other types (for example ComponentEditor and InstanceCreationEditor).
可以为一个属性定义多个编辑器。You can define multiple editors for a property. 您可以使用此方法来选择要使用的编辑器。You use this method to select the editor you want to use.
另请参阅
- ICustomTypeDescriptor
- AddEditorTable(Type, Hashtable)
- GetConverter
- 用户界面类型编辑器概述User Interface Type Editors Overview