AmbientValueAttribute Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av AmbientValueAttribute klassen.
Överlagringar
| Name | Description |
|---|---|
| AmbientValueAttribute(Boolean) |
Initierar en ny instans av AmbientValueAttribute klassen med ett booleskt värde för dess värde. |
| AmbientValueAttribute(Byte) |
Initierar en ny instans av AmbientValueAttribute klassen, givet ett 8-bitars osignerat heltal för dess värde. |
| AmbientValueAttribute(Char) |
Initierar en ny instans av AmbientValueAttribute klassen, givet ett Unicode-tecken för dess värde. |
| AmbientValueAttribute(Double) |
Initierar en ny instans av AmbientValueAttribute klassen, givet ett flyttal med dubbel precision för dess värde. |
| AmbientValueAttribute(Int16) |
Initierar en ny instans av AmbientValueAttribute klassen med ett 16-bitars signerat heltal för dess värde. |
| AmbientValueAttribute(Int32) |
Initierar en ny instans av AmbientValueAttribute klassen med ett 32-bitars signerat heltal för dess värde. |
| AmbientValueAttribute(Int64) |
Initierar en ny instans av AmbientValueAttribute klassen med ett 64-bitars signerat heltal för dess värde. |
| AmbientValueAttribute(Object) |
Initierar en ny instans av AmbientValueAttribute klassen, givet ett objekt för dess värde. |
| AmbientValueAttribute(Single) |
Initierar en ny instans av AmbientValueAttribute klassen, givet ett flyttal med enkel precision för dess värde. |
| AmbientValueAttribute(String) |
Initierar en ny instans av AmbientValueAttribute klassen, givet en sträng för dess värde. |
| AmbientValueAttribute(Type, String) |
Initierar en ny instans av AmbientValueAttribute klassen med tanke på värdet och dess typ. |
AmbientValueAttribute(Boolean)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen med ett booleskt värde för dess värde.
public:
AmbientValueAttribute(bool value);
public AmbientValueAttribute(bool value);
new System.ComponentModel.AmbientValueAttribute : bool -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Boolean)
Parametrar
- value
- Boolean
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Byte)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet ett 8-bitars osignerat heltal för dess värde.
public:
AmbientValueAttribute(System::Byte value);
public AmbientValueAttribute(byte value);
new System.ComponentModel.AmbientValueAttribute : byte -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Byte)
Parametrar
- value
- Byte
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Char)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet ett Unicode-tecken för dess värde.
public:
AmbientValueAttribute(char value);
public AmbientValueAttribute(char value);
new System.ComponentModel.AmbientValueAttribute : char -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Char)
Parametrar
- value
- Char
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Double)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet ett flyttal med dubbel precision för dess värde.
public:
AmbientValueAttribute(double value);
public AmbientValueAttribute(double value);
new System.ComponentModel.AmbientValueAttribute : double -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Double)
Parametrar
- value
- Double
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Int16)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen med ett 16-bitars signerat heltal för dess värde.
public:
AmbientValueAttribute(short value);
public AmbientValueAttribute(short value);
new System.ComponentModel.AmbientValueAttribute : int16 -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Short)
Parametrar
- value
- Int16
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Int32)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen med ett 32-bitars signerat heltal för dess värde.
public:
AmbientValueAttribute(int value);
public AmbientValueAttribute(int value);
new System.ComponentModel.AmbientValueAttribute : int -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Integer)
Parametrar
- value
- Int32
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Int64)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen med ett 64-bitars signerat heltal för dess värde.
public:
AmbientValueAttribute(long value);
public AmbientValueAttribute(long value);
new System.ComponentModel.AmbientValueAttribute : int64 -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Long)
Parametrar
- value
- Int64
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Object)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet ett objekt för dess värde.
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)
Parametrar
- value
- Object
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Single)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet ett flyttal med enkel precision för dess värde.
public:
AmbientValueAttribute(float value);
public AmbientValueAttribute(float value);
new System.ComponentModel.AmbientValueAttribute : single -> System.ComponentModel.AmbientValueAttribute
Public Sub New (value As Single)
Parametrar
- value
- Single
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(String)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen, givet en sträng för dess värde.
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)
Parametrar
- value
- String
Värdet för det här attributet.
Gäller för
AmbientValueAttribute(Type, String)
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
- Källa:
- AmbientValueAttribute.cs
Initierar en ny instans av AmbientValueAttribute klassen med tanke på värdet och dess typ.
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)
Parametrar
- value
- String
Värdet för det här attributet.
- Attribut
Exempel
Följande kodexempel visar hur du använder AmbientValueAttribute för att framtvinga omgivande beteende för en egenskap som heter AlertForeColor. En fullständig kodlista finns i 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