AmbientValueAttribute Construtores

Definição

Inicializa uma nova instância da classe AmbientValueAttribute.

Sobrecargas

Nome Description
AmbientValueAttribute(Boolean)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um valor booliano para seu valor.

AmbientValueAttribute(Byte)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro sem sinal de 8 bits para seu valor.

AmbientValueAttribute(Char)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um caractere Unicode para seu valor.

AmbientValueAttribute(Double)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um número de ponto flutuante de precisão dupla para seu valor.

AmbientValueAttribute(Int16)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 16 bits para seu valor.

AmbientValueAttribute(Int32)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 32 bits para seu valor.

AmbientValueAttribute(Int64)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 64 bits para seu valor.

AmbientValueAttribute(Object)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um objeto para seu valor.

AmbientValueAttribute(Single)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um número de ponto flutuante de precisão única para seu valor.

AmbientValueAttribute(String)

Inicializa uma nova instância da AmbientValueAttribute classe, dada uma cadeia de caracteres para seu valor.

AmbientValueAttribute(Type, String)

Inicializa uma nova instância da AmbientValueAttribute classe, considerando o valor e seu tipo.

AmbientValueAttribute(Boolean)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um valor booliano para seu valor.

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

Parâmetros

value
Boolean

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Byte)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro sem sinal de 8 bits para seu valor.

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

Parâmetros

value
Byte

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Char)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um caractere Unicode para seu valor.

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

Parâmetros

value
Char

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Double)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um número de ponto flutuante de precisão dupla para seu valor.

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

Parâmetros

value
Double

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Int16)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 16 bits para seu valor.

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

Parâmetros

value
Int16

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Int32)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 32 bits para seu valor.

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

Parâmetros

value
Int32

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Int64)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um inteiro com sinal de 64 bits para seu valor.

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

Parâmetros

value
Int64

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Object)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um objeto para seu valor.

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)

Parâmetros

value
Object

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Single)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando um número de ponto flutuante de precisão única para seu valor.

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

Parâmetros

value
Single

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(String)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, dada uma cadeia de caracteres para seu valor.

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)

Parâmetros

value
String

O valor desse atributo.

Aplica-se a

AmbientValueAttribute(Type, String)

Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs
Origem:
AmbientValueAttribute.cs

Inicializa uma nova instância da AmbientValueAttribute classe, considerando o valor e seu tipo.

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)

Parâmetros

type
Type

O Type parâmetro value .

value
String

O valor desse atributo.

Atributos

Exemplos

O exemplo de código a seguir demonstra o uso AmbientValueAttribute para impor o comportamento ambiente para uma propriedade chamada AlertForeColor. Para obter uma listagem de código completa, consulte 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

Aplica-se a