Share via


AmbientValueAttribute Konstruktory

Definice

Inicializuje novou instanci AmbientValueAttribute třídy .

Přetížení

AmbientValueAttribute(Boolean)

Inicializuje novou instanci AmbientValueAttribute třídy zadanou logickou hodnotu pro jeho hodnotu.

AmbientValueAttribute(Byte)

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

AmbientValueAttribute(Char)

Inicializuje novou instanci AmbientValueAttribute třídy dané znakem Unicode pro jeho hodnotu.

AmbientValueAttribute(Double)

Inicializuje novou instanci AmbientValueAttribute třídy s dvojitou přesností číslo s plovoucí desetinou čárkou pro jeho hodnotu.

AmbientValueAttribute(Int16)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 16bitovému celočíselnému číslu se svojí hodnotou.

AmbientValueAttribute(Int32)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 32bitovému celočíselnému číslu se svojí hodnotou.

AmbientValueAttribute(Int64)

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 64bitovému celočíselnému číslu se svojí hodnotou.

AmbientValueAttribute(Object)

Inicializuje novou instanci AmbientValueAttribute třídy s objektem pro jeho hodnotu.

AmbientValueAttribute(Single)

Inicializuje novou instanci AmbientValueAttribute třídy s plovoucí desetinou čárkou s jednou přesností pro její hodnotu.

AmbientValueAttribute(String)

Inicializuje novou instanci AmbientValueAttribute třídy zadaný řetězec pro jeho hodnotu.

AmbientValueAttribute(Type, String)

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

AmbientValueAttribute(Boolean)

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

Inicializuje novou instanci AmbientValueAttribute třídy zadanou logickou hodnotu pro jeho hodnotu.

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

Inicializuje novou instanci AmbientValueAttribute třídy, zadaná 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

Inicializuje novou instanci AmbientValueAttribute třídy dané znakem 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

Inicializuje novou instanci AmbientValueAttribute třídy s dvojitou přesností číslo s plovoucí desetinou čárkou 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

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 16bitovému celočíselnému číslu se svojí hodnotou.

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

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 32bitovému celočíselnému číslu se svojí hodnotou.

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

Inicializuje novou instanci AmbientValueAttribute třídy vzhledem k 64bitovému celočíselnému číslu se svojí hodnotou.

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

Inicializuje novou instanci AmbientValueAttribute třídy s objektem 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

Inicializuje novou instanci AmbientValueAttribute třídy s plovoucí desetinou čárkou s jednou přesností pro její 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

Inicializuje novou instanci AmbientValueAttribute třídy zadaný řetězec 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

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

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

Parametry

type
Type

parametru value .Type

value
String

Hodnota tohoto atributu.

Příklady

Následující příklad kódu ukazuje použití AmbientValueAttribute k vynucení chování okolí pro vlastnost s názvem AlertForeColor. Úplný výpis kódu najdete v tématu Postupy: Použití atributů v ovládacích prvcích model Windows Forms.

[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);
}
<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