次の方法で共有


TypeDescriptor.GetComponentName メソッド (Object)

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

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

パラメータ

  • component
    クラス名を取得する対象の Object

戻り値

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

例外

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

解説

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

たとえば、ボタンのクラス名は 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