AmbientValueAttribute クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AmbientValueAttribute クラスの意味・解説 

AmbientValueAttribute クラス

プロパティ別のソースから値を取得させる目的で、そのプロパティに渡す値を指定しますこのような動作アンビエンス呼ばれます。このクラス継承できません。

名前空間: System.ComponentModel
アセンブリ: System (system.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.All)> _
Public NotInheritable Class
 AmbientValueAttribute
    Inherits Attribute
Dim instance As AmbientValueAttribute
[AttributeUsageAttribute(AttributeTargets.All)] 
public sealed class AmbientValueAttribute :
 Attribute
[AttributeUsageAttribute(AttributeTargets::All)] 
public ref class AmbientValueAttribute sealed
 : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.All) */ 
public final class AmbientValueAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.All) 
public final class AmbientValueAttribute extends
 Attribute
解説解説
使用例使用例

AmbientValueAttribute使用してAlertForeColor というプロパティアンビエント動作適用するコード例次に示します。完全なコードの一覧については、「方法 : Windows フォーム コントロール属性適用する」を参照してください

<AmbientValue(GetType(Color), "Empty"),
 _
Category("Appearance"), _
DefaultValue(GetType(Color), "White"),
 _
Description("The color used for painting alert text.")>
 _
Public Property AlertForeColor() As
 Color
    Get
        If Me.alertForeColorValue = Color.Empty
 AndAlso Not (Me.Parent
 Is Nothing) Then
            Return Parent.ForeColor
        End If

        Return Me.alertForeColorValue
    End Get

    Set(ByVal value As Color)
        Me.alertForeColorValue = value
    End Set
End Property

' This method is used by designers to enable resetting the
' property to its default value.
Public Sub ResetAlertForeColor()
    Me.AlertForeColor = AttributesDemoControl.defaultAlertForeColorValue
End Sub

' This method indicates to designers whether the property
' value is different from the ambient value, in which case
' the designer should persist the value.
Private Function ShouldSerializeAlertForeColor()
 As Boolean
    Return Me.alertForeColorValue <>
 AttributesDemoControl.ambientColorValue
End Function
[AmbientValue(typeof(Color), "Empty")]
[Category("Appearance")]
[DefaultValue(typeof(Color), "White")]
[Description("The color used for painting alert text.")]
public Color AlertForeColor
{
    get
    {
        if (this.alertForeColorValue == Color.Empty
 &&
            this.Parent != null)
        {
            return Parent.ForeColor;
        }

        return this.alertForeColorValue;
    }

    set
    {
        this.alertForeColorValue = value;
    }
}

// This method is used by designers to enable resetting the
// property to its default value.
public void ResetAlertForeColor()
{
    this.AlertForeColor = AttributesDemoControl.defaultAlertForeColorValue;
}

// This method indicates to designers whether the property
// value is different from the ambient value, in which case
// the designer should persist the value.
private bool ShouldSerializeAlertForeColor()
{
    return (this.alertForeColorValue != AttributesDemoControl.ambientColorValue);
}
継承階層継承階層
System.Object
   System.Attribute
    System.ComponentModel.AmbientValueAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「AmbientValueAttribute クラス」の関連用語

AmbientValueAttribute クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AmbientValueAttribute クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS