AmbientValueAttribute Constructeurs

Définition

Initialise une nouvelle instance de la classe AmbientValueAttribute.

Surcharges

Nom Description
AmbientValueAttribute(Boolean)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’une valeur booléenne pour sa valeur.

AmbientValueAttribute(Byte)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier non signé 8 bits pour sa valeur.

AmbientValueAttribute(Char)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un caractère Unicode pour sa valeur.

AmbientValueAttribute(Double)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un nombre à virgule flottante double précision pour sa valeur.

AmbientValueAttribute(Int16)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 16 bits pour sa valeur.

AmbientValueAttribute(Int32)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 32 bits pour sa valeur.

AmbientValueAttribute(Int64)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 64 bits pour sa valeur.

AmbientValueAttribute(Object)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un objet pour sa valeur.

AmbientValueAttribute(Single)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un nombre à virgule flottante simple précision pour sa valeur.

AmbientValueAttribute(String)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’une chaîne pour sa valeur.

AmbientValueAttribute(Type, String)

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction de la valeur et de son type.

AmbientValueAttribute(Boolean)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’une valeur booléenne pour sa valeur.

public:
 AmbientValueAttribute(bool value);
public AmbientValueAttribute(bool value);
new System.ComponentModel.AmbientValueAttribute : bool -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Boolean)

Paramètres

value
Boolean

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Byte)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier non signé 8 bits pour sa valeur.

public:
 AmbientValueAttribute(System::Byte value);
public AmbientValueAttribute(byte value);
new System.ComponentModel.AmbientValueAttribute : byte -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Byte)

Paramètres

value
Byte

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Char)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un caractère Unicode pour sa valeur.

public:
 AmbientValueAttribute(char value);
public AmbientValueAttribute(char value);
new System.ComponentModel.AmbientValueAttribute : char -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Char)

Paramètres

value
Char

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Double)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un nombre à virgule flottante double précision pour sa valeur.

public:
 AmbientValueAttribute(double value);
public AmbientValueAttribute(double value);
new System.ComponentModel.AmbientValueAttribute : double -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Double)

Paramètres

value
Double

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Int16)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 16 bits pour sa valeur.

public:
 AmbientValueAttribute(short value);
public AmbientValueAttribute(short value);
new System.ComponentModel.AmbientValueAttribute : int16 -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Short)

Paramètres

value
Int16

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Int32)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 32 bits pour sa valeur.

public:
 AmbientValueAttribute(int value);
public AmbientValueAttribute(int value);
new System.ComponentModel.AmbientValueAttribute : int -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Integer)

Paramètres

value
Int32

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Int64)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un entier signé 64 bits pour sa valeur.

public:
 AmbientValueAttribute(long value);
public AmbientValueAttribute(long value);
new System.ComponentModel.AmbientValueAttribute : int64 -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Long)

Paramètres

value
Int64

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Object)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un objet pour sa valeur.

public:
 AmbientValueAttribute(System::Object ^ value);
public AmbientValueAttribute(object? value);
public AmbientValueAttribute(object value);
new System.ComponentModel.AmbientValueAttribute : obj -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Object)

Paramètres

value
Object

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Single)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’un nombre à virgule flottante simple précision pour sa valeur.

public:
 AmbientValueAttribute(float value);
public AmbientValueAttribute(float value);
new System.ComponentModel.AmbientValueAttribute : single -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Single)

Paramètres

value
Single

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(String)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction d’une chaîne pour sa valeur.

public:
 AmbientValueAttribute(System::String ^ value);
public AmbientValueAttribute(string? value);
public AmbientValueAttribute(string value);
new System.ComponentModel.AmbientValueAttribute : string -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As String)

Paramètres

value
String

Valeur de cet attribut.

S’applique à

AmbientValueAttribute(Type, String)

Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs
Source:
AmbientValueAttribute.cs

Initialise une nouvelle instance de la AmbientValueAttribute classe, en fonction de la valeur et de son type.

public:
 AmbientValueAttribute(Type ^ type, System::String ^ value);
public AmbientValueAttribute(Type type, string value);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")]
public AmbientValueAttribute(Type type, string value);
new System.ComponentModel.AmbientValueAttribute : Type * string -> System.ComponentModel.AmbientValueAttribute
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Generic TypeConverters may require the generic types to be annotated. For example, NullableConverter requires the underlying type to be DynamicallyAccessedMembers All.")>]
new System.ComponentModel.AmbientValueAttribute : Type * string -> System.ComponentModel.AmbientValueAttribute
Public Sub New (type As Type, value As String)

Paramètres

type
Type

value Du Type paramètre.

value
String

Valeur de cet attribut.

Attributs

Exemples

L’exemple de code suivant montre comment AmbientValueAttribute appliquer le comportement ambiant pour une propriété appelée AlertForeColor. Pour obtenir une description complète du code, consultez How to : Apply Attributes in Windows Forms Controls.

[AmbientValue(typeof(Color), "Empty")]
[Category("Appearance")]
[DefaultValue(typeof(Color), "White")]
[Description("The color used for painting alert text.")]
public Color AlertForeColor
{
    get =>
        _alertForeColorValue == Color.Empty &&
        Parent != null
            ? Parent.ForeColor
            : _alertForeColorValue;

    set => _alertForeColorValue = value;
}

// This method is used by designers to enable resetting the
// property to its default value.
public void ResetAlertForeColor() =>
    AlertForeColor = s_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.
bool ShouldSerializeAlertForeColor() =>
    _alertForeColorValue != s_ambientColorValue;
<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 (Me.Parent IsNot 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

S’applique à