次の方法で共有


TypeDescriptor.GetComponentName メソッド (Object, Boolean)

カスタムの型記述子を使用して、指定したコンポーネントの名前を取得します。

Overloads Public Shared Function GetComponentName( _
   ByVal component As Object, _   ByVal noCustomTypeDesc As Boolean _) As String
[C#]
public static string GetComponentName(objectcomponent,boolnoCustomTypeDesc);
[C++]
public: static String* GetComponentName(Object* component,boolnoCustomTypeDesc);
[JScript]
public static function GetComponentName(
   component : Object,noCustomTypeDesc : Boolean) : String;

パラメータ

  • component
    クラス名を取得する対象の Object
  • noCustomTypeDesc
    ICustomTypeDescriptor のインスタンスが TypeDescriptor を呼び出す場合は true 。それ以外の場合は false

戻り値

指定したコンポーネントのクラスの名前。コンポーネント名がない場合は、 null 参照 (Visual Basic では Nothing) が返されます。

例外

例外の種類 条件
ArgumentNullException component パラメータが null 参照 (Visual Basic では Nothing) です。

解説

このメソッドは、コンポーネントのインスタンスの名前を取得するためにデザイン時に使用されます。通常、コンポーネントが配置されている場所の名前がある場合は、その名前を返します。コンポーネントが ICustomTypeDescriptor を実装している場合、代替の名前を返す場合があります。

たとえば、ボタンのクラス名は System.Windows.Forms.Button です。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

TypeDescriptor クラス | TypeDescriptor メンバ | System.ComponentModel 名前空間 | TypeDescriptor.GetComponentName オーバーロードの一覧 | TypeDescriptor | EventDescriptor | PropertyDescriptor | ICustomTypeDescriptor