AmbientValueAttribute Konstruktorok

Definíció

Inicializálja a AmbientValueAttribute osztály új példányát.

Túlterhelések

Name Description
AmbientValueAttribute(Boolean)

Inicializálja az AmbientValueAttribute osztály új példányát, és logikai értéket ad az értékéhez.

AmbientValueAttribute(Byte)

Inicializálja az AmbientValueAttribute osztály új példányát, amelynek értéke 8 bites, aláíratlan egész szám.

AmbientValueAttribute(Char)

Inicializálja az AmbientValueAttribute osztály új példányát, és unicode karaktert ad az értékéhez.

AmbientValueAttribute(Double)

Inicializálja az AmbientValueAttribute osztály egy új példányát, és dupla pontosságú lebegőpontos számot ad meg az értékéhez.

AmbientValueAttribute(Int16)

Inicializálja az AmbientValueAttribute osztály új példányát, amelynek értéke 16 bites aláírt egész szám.

AmbientValueAttribute(Int32)

Inicializálja az AmbientValueAttribute osztály egy új példányát, amelynek értéke 32 bites aláírt egész szám.

AmbientValueAttribute(Int64)

Inicializálja az AmbientValueAttribute osztály egy új példányát, amelynek értéke 64 bites aláírt egész szám.

AmbientValueAttribute(Object)

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy objektumot ad az értékéhez.

AmbientValueAttribute(Single)

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy pontosságú lebegőpontos számot ad meg az értékéhez.

AmbientValueAttribute(String)

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy sztringet ad az értékéhez.

AmbientValueAttribute(Type, String)

Inicializálja az AmbientValueAttribute osztály új példányát az érték és a típus alapján.

AmbientValueAttribute(Boolean)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály új példányát, és logikai értéket ad az értékéhez.

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

Paraméterek

value
Boolean

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Byte)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály új példányát, amelynek értéke 8 bites, aláíratlan egész szám.

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

Paraméterek

value
Byte

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Char)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály új példányát, és unicode karaktert ad az értékéhez.

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

Paraméterek

value
Char

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Double)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, és dupla pontosságú lebegőpontos számot ad meg az értékéhez.

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

Paraméterek

value
Double

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Int16)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály új példányát, amelynek értéke 16 bites aláírt egész szám.

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

Paraméterek

value
Int16

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Int32)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, amelynek értéke 32 bites aláírt egész szám.

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

Paraméterek

value
Int32

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Int64)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, amelynek értéke 64 bites aláírt egész szám.

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

Paraméterek

value
Int64

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Object)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy objektumot ad az értékéhez.

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éterek

value
Object

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Single)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy pontosságú lebegőpontos számot ad meg az értékéhez.

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

Paraméterek

value
Single

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(String)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály egy új példányát, amely egy sztringet ad az értékéhez.

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éterek

value
String

Az attribútum értéke.

A következőre érvényes:

AmbientValueAttribute(Type, String)

Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs
Forrás:
AmbientValueAttribute.cs

Inicializálja az AmbientValueAttribute osztály új példányát az érték és a típus alapján.

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éterek

type
Type

A Type paraméter értéke value .

value
String

Az attribútum értéke.

Attribútumok

Példák

Az alábbi példakód bemutatja, hogy a környezeti viselkedés kényszerítése egy úgynevezett tulajdonság esetében történik.a0> A teljes kódlistát a Az attribútumok alkalmazása Windows Forms vezérlőkben című témakörben talál.

[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

A következőre érvényes: