AmbientValueAttribute Konstruktory

Definice

Inicializuje novou instanci AmbientValueAttribute třídy.

Přetížení

Name Description
AmbientValueAttribute(Boolean)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k logické hodnotě její hodnoty.

AmbientValueAttribute(Byte)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 8bitové celé číslo bez znaménka pro jeho hodnotu.

AmbientValueAttribute(Char)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem ke znaku Unicode pro jeho hodnotu.

AmbientValueAttribute(Double)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k číslu s plovoucí desetinnou čárkou s dvojitou přesností pro jeho hodnotu.

AmbientValueAttribute(Int16)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 16bitovému signed integer pro jeho hodnotu.

AmbientValueAttribute(Int32)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 32bitovému signed integer pro jeho hodnotu.

AmbientValueAttribute(Int64)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 64bitovému signed integeru pro jeho hodnotu.

AmbientValueAttribute(Object)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k objektu pro jeho hodnotu.

AmbientValueAttribute(Single)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k číslu s plovoucí desetinnou čárkou s jednou přesností pro svou hodnotu.

AmbientValueAttribute(String)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k řetězci pro jeho hodnotu.

AmbientValueAttribute(Type, String)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k hodnotě a jeho typu.

AmbientValueAttribute(Boolean)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k logické hodnotě její hodnoty.

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

Parametry

value
Boolean

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Byte)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 8bitové celé číslo bez znaménka pro jeho hodnotu.

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

Parametry

value
Byte

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Char)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem ke znaku Unicode pro jeho hodnotu.

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

Parametry

value
Char

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Double)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k číslu s plovoucí desetinnou čárkou s dvojitou přesností pro jeho hodnotu.

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

Parametry

value
Double

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Int16)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 16bitovému signed integer pro jeho hodnotu.

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

Parametry

value
Int16

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Int32)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 32bitovému signed integer pro jeho hodnotu.

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

Parametry

value
Int32

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Int64)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 64bitovému signed integeru pro jeho hodnotu.

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

Parametry

value
Int64

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Object)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k objektu pro jeho hodnotu.

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)

Parametry

value
Object

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Single)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k číslu s plovoucí desetinnou čárkou s jednou přesností pro svou hodnotu.

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

Parametry

value
Single

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(String)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k řetězci pro jeho hodnotu.

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)

Parametry

value
String

Hodnota tohoto atributu.

Platí pro

AmbientValueAttribute(Type, String)

Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs
Zdroj:
AmbientValueAttribute.cs

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k hodnotě a jeho typu.

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)

Parametry

type
Type

ParametrType.value

value
String

Hodnota tohoto atributu.

Atributy

Příklady

Následující příklad kódu ukazuje použití AmbientValueAttribute k vynucení okolí chování pro vlastnost volaný AlertForeColor. Úplný výpis kódu najdete v tématu 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

Platí pro