Class DisplayMode
Represents a display mode for a specific Display
public abstract class DisplayMode : ISpanFormattable, IFormattable
- Inheritance
-
DisplayMode
- Implements
- Inherited Members
Properties
Display
Gets the Display associated with this display mode
public Display? Display { get; }
Property Value
Remarks
The value of this property will only be null if this display mode is invalid.
Format
Gets the pixel format of this display mode
public PixelFormat Format { get; }
Property Value
- PixelFormat
The pixel format of this display mode
Height
Gets the logical height of this display mode
public int Height { get; }
Property Value
- int
The logical height of this display mode, in logical pixels
Remarks
To convert the value of this property into actual device pixels, you can multiply it by the value of the PixelDensity property.
PixelDensity
Gets the scale factor for converting logical pixels into actual device pixels for this display mode
public float PixelDensity { get; }
Property Value
- float
The scale factor for converting logical pixels into actual device pixels for this display mode
Remarks
You can multiply the values of the Width and Height properties by the value of this property to get the actual device pixel dimensions of this display mode.
RefreshRate
Gets the refresh rate of this display mode
public float RefreshRate { get; }
Property Value
- float
The refresh rate of this display mode, in Hz (hertz), or
0if the refresh rate is unknown or unspecified
RefreshRateRatio
Gets the refresh rate of this display mode as a ratio of two integers
public (int Numerator, int Denominator) RefreshRateRatio { get; }
Property Value
- (int Width, int Height)
The refresh rate of this display mode as a ratio of two integers, where the first integer (the numerator) can be
0to indicate an unknown or unspecified refresh rate
Width
Gets the logical width of this display mode
public int Width { get; }
Property Value
- int
The logical width of this display mode, in logical pixels
Remarks
To convert the value of this property into actual device pixels, you can multiply it by the value of the PixelDensity property.
Methods
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(IFormatProvider? formatProvider)
Parameters
formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
ToString(string?)
Formats the value of the current instance using the specified format.
public string ToString(string? format)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.
Returns
- string
The value of the current instance in the specified format.
ToString(string?, IFormatProvider?)
Formats the value of the current instance using the specified format.
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format to use.
-or-
A null reference (
Nothingin Visual Basic) to use the default format defined for the type of the IFormattable implementation.formatProviderIFormatProviderThe provider to use to format the value.
-or-
A null reference (
Nothingin Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.
Returns
- string
The value of the current instance in the specified format.
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
Tries to format the value of the current instance into the provided span of characters.
public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
Parameters
destinationSpan<char>The span in which to write this instance's value formatted as a span of characters.
charsWrittenintWhen this method returns, contains the number of characters that were written in
destination.formatReadOnlySpan<char>A span containing the characters that represent a standard or custom format string that defines the acceptable format for
destination.providerIFormatProviderAn optional object that supplies culture-specific formatting information for
destination.