<PackageReference Include="System.Drawing.Common" Version="9.0.0-rc.2.24474.1" />

PrinterResolution

public class PrinterResolution
Represents the resolution supported by a printer.
using System.ComponentModel; using System.Runtime.CompilerServices; namespace System.Drawing.Printing { public class PrinterResolution { private PrinterResolutionKind _kind; public PrinterResolutionKind Kind { get { return _kind; } set { if ((value < PrinterResolutionKind.High || value > PrinterResolutionKind.Custom) ? true : false) throw new InvalidEnumArgumentException("value", (int)value, typeof(PrinterResolutionKind)); _kind = value; } } public int X { get; set; } public int Y { get; set; } public PrinterResolution() { _kind = PrinterResolutionKind.Custom; } internal PrinterResolution(PrinterResolutionKind kind, int x, int y) { _kind = kind; X = x; Y = y; } [NullableContext(1)] public override string ToString() { if (_kind == PrinterResolutionKind.Custom) return FormattableString.Invariant(FormattableStringFactory.Create("[PrinterResolution X={0} Y={1}]", X, Y)); DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(20, 1); defaultInterpolatedStringHandler.AppendLiteral("[PrinterResolution "); defaultInterpolatedStringHandler.AppendFormatted(Kind); defaultInterpolatedStringHandler.AppendLiteral("]"); return defaultInterpolatedStringHandler.ToStringAndClear(); } } }