70 instantiations of Margins
System.Drawing.Common (4)
System\Drawing\Printing\MarginsConverter.cs (2)
55
return new
Margins
(values[0], values[1], values[2], values[3]);
115
: (object)new
Margins
((int)left, (int)right, (int)top, (int)bottom);
System\Drawing\Printing\PageSettings.cs (1)
17
private Margins _margins =
new
();
System\Drawing\Printing\PrinterUnitConvert.cs (1)
55
public static Margins Convert(Margins value, PrinterUnit fromUnit, PrinterUnit toUnit) =>
new
()
System.Drawing.Common.Tests (35)
System\Drawing\Printing\MarginsConverterTests.cs (1)
123
Margins margins =
new
() { Left = 1, Right = 2, Top = 3, Bottom = 4 };
System\Drawing\Printing\MarginsTests.cs (31)
35
Margins margins =
new
();
48
Margins margins =
new
(left, right, top, bottom);
58
AssertExtensions.Throws<ArgumentOutOfRangeException, ArgumentException>("left", null, () => new
Margins
(-1, 2, 3, 4));
64
AssertExtensions.Throws<ArgumentOutOfRangeException, ArgumentException>("right", null, () => new
Margins
(1, -1, 3, 4));
70
AssertExtensions.Throws<ArgumentOutOfRangeException, ArgumentException>("top", null, () => new
Margins
(1, 2, -1, 4));
76
AssertExtensions.Throws<ArgumentOutOfRangeException, ArgumentException>("bottom", null, () => new
Margins
(1, 2, 3, -1));
81
Margins margins =
new
(1, 2, 3, 4);
83
yield return new object[] { margins, new
Margins
(1, 2, 3, 4), true };
84
yield return new object[] { margins, new
Margins
(2, 2, 3, 4), false };
85
yield return new object[] { margins, new
Margins
(1, 3, 3, 4), false };
86
yield return new object[] { margins, new
Margins
(1, 2, 4, 4), false };
87
yield return new object[] { margins, new
Margins
(1, 2, 3, 5), false };
106
Margins margins =
new
(1, 2, 3, 4);
108
yield return new object[] { margins, new
Margins
(1, 2, 3, 4), true };
109
yield return new object[] { margins, new
Margins
(2, 2, 3, 4), false };
110
yield return new object[] { margins, new
Margins
(1, 3, 3, 4), false };
111
yield return new object[] { margins, new
Margins
(1, 2, 4, 4), false };
112
yield return new object[] { margins, new
Margins
(1, 2, 3, 5), false };
115
yield return new object[] { null, new
Margins
(1, 2, 3, 4), false };
116
yield return new object[] { new
Margins
(1, 2, 3, 4), null, false };
129
yield return new object[] { new
Margins
(), "[Margins Left=100 Right=100 Top=100 Bottom=100]" };
130
yield return new object[] { new
Margins
(1, 2, 3, 4), "[Margins Left=1 Right=2 Top=3 Bottom=4]" };
143
Margins margins =
new
(1, 2, 3, 4);
163
Margins margins =
new
()
177
Margins margins =
new
();
185
Margins margins =
new
()
199
Margins margins =
new
();
207
Margins margins =
new
()
221
Margins margins =
new
();
229
Margins margins =
new
()
243
Margins margins =
new
();
System\Drawing\Printing\PageSettingsTests.cs (1)
41
Margins = new
Margins
(120, 130, 140, 150),
System\Drawing\Printing\PrinterUnitConvertTests.cs (2)
145
var converted = PrinterUnitConvert.Convert(new
Margins
(100, 1000, 100, 1000), fromUnit, toUnit);
146
Assert.Equal(new
Margins
(expectedLeft, expectedRight, expectedTop, expectedBottom), converted);
System.Windows.Forms (2)
System\Windows\Forms\Printing\PageSetupDialog.cs (2)
104
set => _minMargins = value ?? new
Margins
(0, 0, 0, 0);
249
Margins newMargins =
new
()
System.Windows.Forms.Tests (29)
System\Windows\Forms\PageSetupDialogTests.cs (29)
22
Assert.Equal(new
Margins
(0, 0, 0, 0), dialog.MinMargins);
196
yield return new object[] { null, new
Margins
(0, 0, 0, 0) };
197
yield return new object[] { new
Margins
(), new
Margins
() };
198
yield return new object[] { new
Margins
(1, 2, 3, 4), new
Margins
(1, 2, 3, 4) };
199
yield return new object[] { new
Margins
(0, 0, 0, 0), new
Margins
(0, 0, 0, 0) };
200
yield return new object[] { new
Margins
(1, 0, 0, 0), new
Margins
(1, 0, 0, 0) };
201
yield return new object[] { new
Margins
(0, 1, 0, 0), new
Margins
(0, 1, 0, 0) };
202
yield return new object[] { new
Margins
(0, 0, 1, 0), new
Margins
(0, 0, 1, 0) };
203
yield return new object[] { new
Margins
(0, 0, 0, 1), new
Margins
(0, 0, 0, 1) };
228
dialog.MinMargins = new
Margins
(1, 2, 3, 4);
230
Assert.Equal(new
Margins
(1, 2, 3, 4), dialog.MinMargins);
234
Assert.Equal(new
Margins
(0, 0, 0, 0), dialog.MinMargins);
240
yield return new object[] { new
Margins
(), true };
241
yield return new object[] { new
Margins
(1, 2, 3, 4), true };
242
yield return new object[] { new
Margins
(0, 0, 0, 0), false };
243
yield return new object[] { new
Margins
(1, 0, 0, 0), true };
244
yield return new object[] { new
Margins
(0, 1, 0, 0), true };
245
yield return new object[] { new
Margins
(0, 0, 1, 0), true };
246
yield return new object[] { new
Margins
(0, 0, 0, 10), true };
393
Assert.Equal(new
Margins
(0, 0, 0, 0), dialog.MinMargins);
414
MinMargins = new
Margins
(1, 2, 3, 4),
429
Assert.Equal(new
Margins
(0, 0, 0, 0), dialog.MinMargins);
54 references to Margins
System.Drawing (1)
System.Drawing.cs (1)
110
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Printing.
Margins
))]
System.Drawing.Common (17)
System\Drawing\Printing\Margins.cs (9)
33
/// Initializes a new instance of a the <see cref='
Margins
'/> class with one-inch margins.
40
/// Initializes a new instance of a the <see cref='
Margins
'/> class with the specified left, right, top, and bottom margins.
178
obj is
Margins
margins
190
/// Tests whether two <see cref='
Margins
'/> objects are identical.
192
public static bool operator ==(
Margins
? m1,
Margins
? m2)
208
/// Tests whether two <see cref='
Margins
'/> objects are different.
210
public static bool operator !=(
Margins
? m1,
Margins
? m2) => !(m1 == m2);
System\Drawing\Printing\MarginsConverter.cs (3)
12
/// Provides a type converter to convert <see cref='
Margins
'/> to and from various other representations, such as a string.
69
if (value is
Margins
margins)
90
if (typeof(
Margins
).GetConstructor([typeof(int), typeof(int), typeof(int), typeof(int)]) is { } constructor)
System\Drawing\Printing\PageSettings.cs (3)
17
private
Margins
_margins = new();
105
public
Margins
Margins
217
result._margins = (
Margins
)_margins.Clone();
System\Drawing\Printing\PrinterUnitConvert.cs (2)
55
public static
Margins
Convert(
Margins
value, PrinterUnit fromUnit, PrinterUnit toUnit) => new()
System.Drawing.Common.Tests (28)
System\Drawing\Printing\MarginsConverterTests.cs (7)
62
Assert.IsType<
Margins
>(result);
63
Margins
margins = result as
Margins
;
91
Assert.IsType<
Margins
>(result);
92
Margins
margins = result as
Margins
;
123
Margins
margins = new() { Left = 1, Right = 2, Top = 3, Bottom = 4 };
System\Drawing\Printing\MarginsTests.cs (20)
35
Margins
margins = new();
48
Margins
margins = new(left, right, top, bottom);
81
Margins
margins = new(1, 2, 3, 4);
95
public void Equals_InvokeObject_ReturnsExpected(
Margins
margins, object obj, bool expected)
98
if (obj is
Margins
)
106
Margins
margins = new(1, 2, 3, 4);
121
public void Equals_InvokeMargin_ReturnsExpected(
Margins
margins1,
Margins
margins2, bool expected)
135
public void ToString_Invoke_ReturnsExpected(
Margins
margins, string expected)
143
Margins
margins = new(1, 2, 3, 4);
144
Margins
clonedMargins = Assert.IsType<
Margins
>(margins.Clone());
163
Margins
margins = new()
177
Margins
margins = new();
185
Margins
margins = new()
199
Margins
margins = new();
207
Margins
margins = new()
221
Margins
margins = new();
229
Margins
margins = new()
243
Margins
margins = new();
System\Drawing\Printing\PrinterUnitConvertTests.cs (1)
145
var
converted = PrinterUnitConvert.Convert(new Margins(100, 1000, 100, 1000), fromUnit, toUnit);
System.Windows.Forms (5)
System\Windows\Forms\Printing\PageSetupDialog.cs (5)
24
private
Margins
? _minMargins;
101
public
Margins
? MinMargins
249
Margins
newMargins = new()
304
Margins
margins = PrinterUnitConvert.Convert(MinMargins, PrinterUnit.Display, toUnit);
313
Margins
margins = PrinterUnitConvert.Convert(_pageSettings.Margins, PrinterUnit.Display, toUnit);
System.Windows.Forms.Tests (3)
System\Windows\Forms\PageSetupDialogTests.cs (3)
208
public void PageSetupDialog_MinMargins_Set_GetReturnsExpected(
Margins
value,
Margins
expected)
251
public void PageSetupDialog_MinMargins_ShouldSerializeValue_ReturnsExpected(
Margins
value, bool expected)