AmbientValueAttribute Конструкторы

Определение

Инициализирует новый экземпляр класса AmbientValueAttribute.

Перегрузки

Имя Описание
AmbientValueAttribute(Boolean)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая логическое значение для его значения.

AmbientValueAttribute(Byte)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 8-разрядное целое число без знака для его значения.

AmbientValueAttribute(Char)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая символ Юникода для его значения.

AmbientValueAttribute(Double)

Инициализирует новый экземпляр AmbientValueAttribute класса с двойной точностью с плавающей запятой для его значения.

AmbientValueAttribute(Int16)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 16-разрядное целое число со знаком для его значения.

AmbientValueAttribute(Int32)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 32-разрядное целое число со знаком для его значения.

AmbientValueAttribute(Int64)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 64-разрядное целое число со знаком для его значения.

AmbientValueAttribute(Object)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая объект для его значения.

AmbientValueAttribute(Single)

Инициализирует новый экземпляр AmbientValueAttribute класса с одной точностью с плавающей запятой для его значения.

AmbientValueAttribute(String)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая строку для его значения.

AmbientValueAttribute(Type, String)

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая значение и его тип.

AmbientValueAttribute(Boolean)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая логическое значение для его значения.

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

Параметры

value
Boolean

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Byte)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 8-разрядное целое число без знака для его значения.

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

Параметры

value
Byte

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Char)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая символ Юникода для его значения.

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

Параметры

value
Char

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Double)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса с двойной точностью с плавающей запятой для его значения.

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

Параметры

value
Double

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Int16)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 16-разрядное целое число со знаком для его значения.

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

Параметры

value
Int16

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Int32)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 32-разрядное целое число со знаком для его значения.

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

Параметры

value
Int32

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Int64)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая 64-разрядное целое число со знаком для его значения.

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

Параметры

value
Int64

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Object)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая объект для его значения.

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)

Параметры

value
Object

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Single)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса с одной точностью с плавающей запятой для его значения.

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

Параметры

value
Single

Значение этого атрибута.

Применяется к

AmbientValueAttribute(String)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая строку для его значения.

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)

Параметры

value
String

Значение этого атрибута.

Применяется к

AmbientValueAttribute(Type, String)

Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs
Исходный код:
AmbientValueAttribute.cs

Инициализирует новый экземпляр AmbientValueAttribute класса, учитывая значение и его тип.

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)

Параметры

type
Type

value ПараметрType.

value
String

Значение этого атрибута.

Атрибуты

Примеры

В следующем примере кода демонстрируется применение AmbientValueAttribute внешнего поведения для вызываемого AlertForeColorсвойства. Полный список кода см. в разделе 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

Применяется к