次の方法で共有


BrowsableAttribute コンストラクタ

BrowsableAttribute クラスの新しいインスタンスを初期化します。

Public Sub New( _
   ByVal browsable As Boolean _)
[C#]
public BrowsableAttribute(
   boolbrowsable);
[C++]
public: BrowsableAttribute(
   boolbrowsable);
[JScript]
public function BrowsableAttribute(
   browsable : Boolean);

パラメータ

  • browsable
    特定のプロパティまたはイベントをデザイン時に変更できる場合は true 。それ以外の場合は false 。既定値は true です。

解説

truector コンストラクタを使用してプロパティをマークすると、この属性の値は定数メンバ Yes に設定されます。値 falsector コンストラクタを使用してマークされているプロパティの場合、値は No になります。したがって、コード内でこの属性の値を確認する場合は、属性を BrowsableAttribute.Yes または BrowsableAttribute.No として指定する必要があります。

使用例

プロパティを参照可能としてマークする例を次に示します。このコードは、新しい BrowsableAttribute を作成し、その値を BrowsableAttribute.Yes に設定してから、その属性をプロパティに関連付けます。

 
<Browsable(True)> _
Public Property MyProperty() As Integer
    Get
        ' Insert code here.
        Return 0
    End Get
    Set
        ' Insert code here.
    End Set
End Property

[C#] 
[Browsable(true)]
 public int MyProperty {
    get {
       // Insert code here.
       return 0;
    }
    set {
       // Insert code here.
    }
 }
    

[C++] 
public:
    [Browsable(true)]
    __property int get_MyProperty() {
        // Insert code here.
        return 0;
    }
    __property void set_MyProperty( int value ) {
        // Insert code here.
    }

[JScript] 
Browsable(true)
public function get MyProperty() : int {
      // Insert code here.
      return 0;
 }

 public function set MyProperty(value : int) {
 }
   

必要条件

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

参照

BrowsableAttribute クラス | BrowsableAttribute メンバ | System.ComponentModel 名前空間 | BrowsableAttribute