130 instantiations of Icon
DesignSurface (1)
MainForm.cs (1)
166
pb1.Image = new
Icon
("painter.ico").ToBitmap();
System.Drawing.Common.Tests (65)
mono\System.Drawing\BitmapTests.cs (4)
1191
using (Icon icon =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
1209
using (Icon icon =
new
(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")))
1227
using (Icon icon =
new
(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")))
1245
using (Icon icon =
new
(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")))
System\Drawing\BitmapTests.cs (5)
661
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")), 16, 16 };
662
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")), 32, 32 };
663
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")), 64, 64 };
664
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")), 96, 96 };
767
using Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
System\Drawing\GdiPlusHandlesTests.cs (1)
25
using Icon ico =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
System\Drawing\IconConverterTests.cs (1)
21
_icon = new
Icon
(Path.Join("bitmaps", "TestIcon.ico"));
System\Drawing\IconTests.cs (52)
40
using Icon icon =
new
(Helpers.GetTestBitmapPath(name));
70
using Icon icon =
new
(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height);
80
using Icon icon =
new
(Helpers.GetTestBitmapPath(fileName), size);
89
AssertExtensions.Throws<ArgumentNullException>("path", () => new
Icon
((string)null));
90
AssertExtensions.Throws<ArgumentNullException>("path", () => new
Icon
((string)null, new Size(32, 32)));
91
AssertExtensions.Throws<ArgumentNullException>("path", () => new
Icon
((string)null, 32, 32));
98
Icon icon =
new
(stream);
108
Icon icon =
new
(stream);
125
using Icon icon =
new
(stream, size.Width, size.Height);
136
using Icon icon =
new
(stream, size);
145
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new
Icon
((Stream)null));
146
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new
Icon
((Stream)null, 32, 32));
147
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new
Icon
((Stream)null, new Size(32, 32)));
215
Assert.Throws(exceptionType, () => new
Icon
(stream));
222
using Icon sourceIcon =
new
(Helpers.GetTestBitmapPath(fileName));
223
using Icon icon =
new
(sourceIcon, size.Width, size.Height);
234
using Icon sourceIcon =
new
(Helpers.GetTestBitmapPath(fileName));
235
using Icon icon =
new
(sourceIcon, size);
245
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new
Icon
((Icon)null, 32, 32));
246
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new
Icon
((Icon)null, new Size(32, 32)));
252
using Icon icon =
new
(typeof(IconTests), "48x48_multiple_entries_4bit.ico");
260
Assert.Throws<NullReferenceException>(() => new
Icon
(null, "48x48_multiple_entries_4bit.ico"));
269
AssertExtensions.Throws<ArgumentException>(null, () => new
Icon
(type, resource));
275
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new
Icon
(typeof(Icon), null));
281
using Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
305
Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
322
using Icon source =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
337
using Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size);
425
SaveAndCompare(new
Icon
(Helpers.GetTestBitmapPath(fileName)), true);
432
using Icon icon =
new
(filePath);
442
Icon icon =
new
(filePath);
452
using Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
459
using Icon source =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
469
using Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
479
using Icon source =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
507
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")) };
508
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")) };
509
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico")) };
510
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")) };
511
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")) };
512
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 48, 48) };
513
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 256, 256) };
514
yield return new object[] { new
Icon
(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 0, 0) };
544
using Icon originalIcon =
new
(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
630
return new
Icon
(stream);
636
using Icon icon1 =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
646
using Icon icon1 =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
664
using (Icon icon1 =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
679
using (Icon icon1 =
new
(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
706
Icon icon =
new
(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
720
using Icon loaded =
new
(outputStream);
751
using Icon icon =
new
(stream, new Size(32, 32));
System\Drawing\ImageConverterTests.cs (1)
38
using Icon icon =
new
(Helpers.GetTestBitmapPath(name));
System\Drawing\TextureBrushTests.cs (1)
41
using Icon icon =
new
(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico"));
System.Windows.Forms (8)
System\Resources\ResxFileRef.Converter.cs (1)
141
Icon ico =
new
(memoryStream);
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (1)
78
internal static Icon ErrorIcon => s_errorIcon ??= new
Icon
(typeof(DataGridView), "IconInError");
System\Windows\Forms\Design\ComponentEditorPage.cs (1)
93
get => _icon ??= new
Icon
(typeof(ComponentEditorPage), "ComponentEditorPage");
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (1)
550
Icon defaultIcon =
new
(typeof(ErrorProvider), "Error");
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
460
_provider.Icon = new
Icon
(icon, (int)(icon.Width * factor), (int)(icon.Height * factor));
System\Windows\Forms\Form.cs (2)
872
s_defaultIcon ??= new
Icon
(typeof(Form), "wfc");
6356
_smallIcon = new
Icon
(icon, SystemInformation.SmallIconSize);
System\Windows\Forms\MDI\MDIControlStrip.cs (1)
82
using Icon smallIcon =
new
(icon, SystemInformation.SmallIconSize);
System.Windows.Forms.Design (21)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.EditorButton.cs (1)
125
using Icon icon =
new
(typeof(DesignerActionPanel), "Arrow.ico");
System\Drawing\Design\IconEditor.cs (1)
107
protected virtual Icon LoadFromStream(Stream stream) =>
new
(stream);
System\Windows\Forms\Design\Behavior\ContainerSelectorGlyph.cs (1)
48
_glyph ??= new
Icon
(typeof(ContainerSelectorGlyph), "MoverGlyph").ToBitmap();
System\Windows\Forms\Design\ImageListImage.cs (1)
54
return new ImageListImage((new
Icon
(stream)).ToBitmap());
System\Windows\Forms\Design\StandardCommandToolStripMenuItem.cs (1)
87
_image = new
Icon
(typeof(ToolStripMenuItem), _name).ToBitmap();
System\Windows\Forms\Design\StandardMenuStripVerb.cs (9)
410
image = new
Icon
(typeof(ToolStripMenuItem), "new").ToBitmap();
414
image = new
Icon
(typeof(ToolStripMenuItem), "open").ToBitmap();
418
image = new
Icon
(typeof(ToolStripMenuItem), "save").ToBitmap();
422
image = new
Icon
(typeof(ToolStripMenuItem), "printPreview").ToBitmap();
426
image = new
Icon
(typeof(ToolStripMenuItem), "print").ToBitmap();
430
image = new
Icon
(typeof(ToolStripMenuItem), "cut").ToBitmap();
434
image = new
Icon
(typeof(ToolStripMenuItem), "copy").ToBitmap();
438
image = new
Icon
(typeof(ToolStripMenuItem), "paste").ToBitmap();
442
image = new
Icon
(typeof(ToolStripMenuItem), "help").ToBitmap();
System\Windows\Forms\Design\TemplateNodeCustomMenuItemCollection.cs (1)
88
image = new
Icon
(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
610
image = new
Icon
(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripItemCustomMenuItemCollection.cs (4)
75
item.Image = new
Icon
(typeof(ToolStripMenuItem), imageName).ToBitmap();
123
Image = new
Icon
(typeof(ToolStripMenuItem), "image").ToBitmap(),
218
_editItemsToolStripMenuItem.Image = new
Icon
(typeof(ToolStripMenuItem), "editdropdownlist").ToBitmap();
533
image = new
Icon
(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripItemDesigner.cs (1)
818
image = new
Icon
(typeof(ToolStripButton), "blank").ToBitmap();
System.Windows.Forms.Design.Tests (4)
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (3)
400
using Icon expected =
new
(@"Resources\Icon1.ico");
407
using Icon icon =
new
(SystemIcons.Exclamation, 16, 16);
455
using Icon expected =
new
(@"Resources\Icon1.ico");
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
97
using Icon icon =
new
(stream);
System.Windows.Forms.Primitives (2)
System\Windows\Forms\Internals\ScaleHelper.cs (2)
350
using Icon icon =
new
(resourceStream, size.IsEmpty ? SystemIconSize : size);
432
return (icon.Width == width && icon.Height == height) ? icon :
new
(icon, width, height);
System.Windows.Forms.Tests (29)
System\Windows\Forms\EmbeddedResourceTests.cs (1)
209
using Icon icon =
new
(stream);
System\Windows\Forms\ErrorProviderTests.cs (1)
1337
using Icon newIcon =
new
("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (5)
648
yield return new object[] { transparentColor, new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
1748
yield return new object[] { new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
1779
yield return new object[] { new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
1799
yield return new object[] { index, new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
1831
yield return new object[] { new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
System\Windows\Forms\ImageListTests.cs (2)
832
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
888
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\NotifyIconTests.cs (20)
197
yield return new object[] { new
Icon
("bitmaps/10x16_one_entry_32bit.ico") };
219
using Icon oldValue =
new
(new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), 10, 10);
252
yield return new object[] { new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), 1 };
311
using Icon value =
new
("bitmaps/10x16_one_entry_32bit.ico");
335
foreach (Icon icon in new Icon[] { null,
new
("bitmaps/10x16_one_entry_32bit.ico") })
385
foreach (Icon icon in new Icon[] { null,
new
("bitmaps/10x16_one_entry_32bit.ico") })
395
yield return new object[] { false, new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 0 };
396
yield return new object[] { false, new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 0 };
397
yield return new object[] { true, new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 1 };
398
yield return new object[] { true, new
Icon
("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 1 };
477
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
537
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
761
foreach (Icon icon in new Icon[] { null,
new
("bitmaps/10x16_one_entry_32bit.ico") })
839
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
855
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
880
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
906
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
919
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
933
using Icon icon =
new
("bitmaps/10x16_one_entry_32bit.ico");
276 references to Icon
DesignSurface (1)
MainForm.Designer.cs (1)
297
this.Icon = ((System.Drawing.
Icon
)(resources.GetObject("$this.Icon")));
PresentationUI (13)
artifacts\obj\PresentationUI\x86\Debug\net10.0\MS.Internal.Documents.Resources.cs (8)
64
internal static System.Drawing.
Icon
DocumentApplication {
67
return ((System.Drawing.
Icon
)(obj));
114
internal static System.Drawing.
Icon
RMPublishingEveryone {
117
return ((System.Drawing.
Icon
)(obj));
124
internal static System.Drawing.
Icon
RMPublishingPeoplePicker {
127
return ((System.Drawing.
Icon
)(obj));
134
internal static System.Drawing.
Icon
RMPublishingRemove {
137
return ((System.Drawing.
Icon
)(obj));
MS\Internal\Documents\DialogBaseForm.cs (1)
79
Icon = (System.Drawing.
Icon
)Resources.DocumentApplication;
MS\Internal\Documents\RMPublishingDialog.cs (4)
491
private void SetupIconButton(Button button,
Icon
icon, string text, string tooltip)
934
(System.Drawing.
Icon
)Resources.RMPublishingPeoplePicker,
939
(System.Drawing.
Icon
)Resources.RMPublishingEveryone,
944
(System.Drawing.
Icon
)Resources.RMPublishingRemove,
System.Drawing (1)
System.Drawing.cs (1)
62
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.
Icon
))]
System.Drawing.Common.Tests (113)
mono\System.Drawing\BitmapTests.cs (4)
1191
using (
Icon
icon = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
1209
using (
Icon
icon = new(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")))
1227
using (
Icon
icon = new(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")))
1245
using (
Icon
icon = new(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")))
System\Drawing\BitmapTests.cs (2)
669
public void FromHicon_IconHandle_ReturnsExpected(
Icon
icon, int width, int height)
767
using
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
System\Drawing\GdiPlusHandlesTests.cs (1)
25
using
Icon
ico = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
System\Drawing\IconConverterTests.cs (4)
13
private readonly
Icon
_icon;
107
Icon
newIcon = (
Icon
)_icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, _iconBytes);
119
newIcon = (
Icon
)_icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, _iconBytes);
System\Drawing\IconTests.cs (92)
40
using
Icon
icon = new(Helpers.GetTestBitmapPath(name));
70
using
Icon
icon = new(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height);
80
using
Icon
icon = new(Helpers.GetTestBitmapPath(fileName), size);
98
Icon
icon = new(stream);
108
Icon
icon = new(stream);
125
using
Icon
icon = new(stream, size.Width, size.Height);
136
using
Icon
icon = new(stream, size);
222
using
Icon
sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
223
using
Icon
icon = new(sourceIcon, size.Width, size.Height);
234
using
Icon
sourceIcon = new(Helpers.GetTestBitmapPath(fileName));
235
using
Icon
icon = new(sourceIcon, size);
245
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((
Icon
)null, 32, 32));
246
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((
Icon
)null, new Size(32, 32)));
252
using
Icon
icon = new(typeof(IconTests), "48x48_multiple_entries_4bit.ico");
264
[InlineData(typeof(
Icon
), "")]
265
[InlineData(typeof(
Icon
), "48x48_multiple_entries_4bit.ico")]
275
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new Icon(typeof(
Icon
), null));
281
using
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
282
using
Icon
clone = Assert.IsType<
Icon
>(icon.Clone());
293
using
var
icon =
Icon
.FromHandle(SystemIcons.Hand.Handle);
294
using
Icon
clone = Assert.IsType<
Icon
>(icon.Clone());
305
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
313
Icon
icon =
Icon
.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
322
using
Icon
source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
323
using
var
icon =
Icon
.FromHandle(source.Handle);
337
using
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size);
379
using
Icon
icon =
Icon
.ExtractAssociatedIcon(filePath);
390
Assert.Null(
Icon
.ExtractAssociatedIcon("http://microsoft.com"));
394
Assert.Throws<FileNotFoundException>(() =>
Icon
.ExtractAssociatedIcon("http://microsoft.com"));
401
AssertExtensions.Throws<ArgumentNullException, ArgumentException>("filePath", null, () =>
Icon
.ExtractAssociatedIcon(null));
407
AssertExtensions.Throws<ArgumentException>("filePath", null, () =>
Icon
.ExtractAssociatedIcon(""));
413
Assert.Throws<FileNotFoundException>(() =>
Icon
.ExtractAssociatedIcon("no-such-file.png"));
432
using
Icon
icon = new(filePath);
442
Icon
icon = new(filePath);
452
using
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
459
using
Icon
source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
460
var
icon =
Icon
.FromHandle(source.Handle);
469
using
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
479
using
Icon
source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
480
using
var
icon =
Icon
.FromHandle(source.Handle);
499
Icon
icon =
Icon
.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
519
public void ToBitmap_BitmapIcon_ReturnsExpected(
Icon
icon)
544
using
Icon
originalIcon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
545
using
Icon
icon =
Icon
.FromHandle(originalIcon.Handle);
556
using
Icon
icon = GetPngIcon();
591
using
Icon
icon = GetPngIcon();
610
private static
Icon
GetPngIcon()
636
using
Icon
icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
637
using
Icon
icon2 =
Icon
.FromHandle(icon1.Handle);
646
using
Icon
icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
647
using (
Icon
icon2 =
Icon
.FromHandle(icon1.Handle))
654
using
Icon
icon3 =
Icon
.FromHandle(icon1.Handle);
664
using (
Icon
icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
669
using
Icon
icon2 =
Icon
.FromHandle(handle);
679
using (
Icon
icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")))
684
using (
Icon
icon2 =
Icon
.FromHandle(handle))
691
using
Icon
icon3 =
Icon
.FromHandle(handle);
700
AssertExtensions.Throws<ArgumentException>("handle", null, () =>
Icon
.FromHandle(IntPtr.Zero));
706
Icon
icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico"));
714
private static void SaveAndCompare(
Icon
icon, bool alpha)
720
using
Icon
loaded = new(outputStream);
751
using
Icon
icon = new(stream, new Size(32, 32));
758
FieldInfo fi = typeof(
Icon
).GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic);
786
Assert.Throws<ArgumentNullException>(() => {
Icon
.ExtractIcon(null!, 0, 16); });
787
Assert.Throws<ArgumentNullException>(() => {
Icon
.ExtractIcon(null!, 0); });
793
Assert.Throws<IOException>(() => {
Icon
.ExtractIcon(string.Empty, 0, 16); });
794
Assert.Throws<IOException>(() => {
Icon
.ExtractIcon(string.Empty, 0); });
804
Assert.Throws<ArgumentOutOfRangeException>(() => {
Icon
.ExtractIcon("Foo", 0, size); });
812
Icon
.ExtractIcon(Path.GetRandomFileName() + ".ico", 0, 16);
817
Icon
.ExtractIcon(Path.GetRandomFileName() + ".ico", 0);
825
Assert.Null(
Icon
.ExtractIcon(file.Path, 0, 16));
826
Assert.Null(
Icon
.ExtractIcon(file.Path, 0));
832
Icon
? icon;
834
while ((icon =
Icon
.ExtractIcon("regedit.exe", count, 16)) is not null)
850
using
Icon
? icon =
Icon
.ExtractIcon("regedit.exe", -100, 256);
System\Drawing\ImageConverterTests.cs (3)
38
using
Icon
icon = new(Helpers.GetTestBitmapPath(name));
64
Assert.True(_imgConv.CanConvertFrom(typeof(
Icon
)), "Icon (no context)");
65
Assert.True(_imgConv.CanConvertFrom(null, typeof(
Icon
)), "Icon");
System\Drawing\SystemIconsTests.cs (6)
22
public static object[] Icon(Func<
Icon
> getIcon) => [getIcon];
26
public void SystemIcons_Get_ReturnsExpected(Func<
Icon
> getIcon)
28
Icon
icon = getIcon();
36
using
Icon
icon = SystemIcons.GetStockIcon(stockIcon);
43
using
Icon
icon = SystemIcons.GetStockIcon(StockIconId.Lock, size: 256);
68
using
Icon
icon = SystemIcons.GetStockIcon(StockIconId.Shield, options);
System\Drawing\TextureBrushTests.cs (1)
41
using
Icon
icon = new(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico"));
System.Windows.Forms (65)
System\Drawing\Design\UITypeEditor.cs (1)
57
[typeof(
Icon
)] = $"System.Drawing.Design.IconEditor, {(Assemblies.SystemDrawingDesign)}",
System\Resources\ResxFileRef.Converter.cs (1)
141
Icon
ico = new(memoryStream);
System\Windows\Forms\ActiveX\AxHost.cs (1)
3538
=> cursor is null ? null :
Icon
.FromHandle(cursor.Handle).CreateIPictureRCW(copy: true);
System\Windows\Forms\ComponentModel\COM2Interop\COM2PictureConverter.cs (4)
27
_pictureType = typeof(
Icon
);
66
_pictureType = typeof(
Icon
);
67
_lastManaged =
Icon
.FromHandle(extendedHandle);
105
if (managedValue is
Icon
icon)
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (9)
16
private static readonly Type s_defaultTypeIcon = typeof(
Icon
);
19
private static
Icon
? s_errorIcon;
78
internal static
Icon
ErrorIcon => s_errorIcon ??= new Icon(typeof(DataGridView), "IconInError");
377
if (formattedValue is not
Icon
ico)
415
Icon
? ico = null;
418
ico = formattedValue as
Icon
;
556
Icon
? icon = owningImageColumn.Icon;
783
Icon
? icon = image is null ? formattedValue as
Icon
: null;
System\Windows\Forms\Controls\DataGridView\DataGridViewImageColumn.cs (3)
15
private
Icon
? _icon;
108
public
Icon
? Icon
228
DefaultCellStyle.NullValue is
Icon
icon &&
System\Windows\Forms\Controls\ImageList\ImageList.cs (3)
293
else if (original._image is
Icon
originalIcon)
348
private int AddIconToHandle(Original original,
Icon
icon)
440
if (original._image is
Icon
originalIcon)
System\Windows\Forms\Controls\ImageList\ImageList.ImageCollection.cs (3)
245
public void Add(string key,
Icon
icon)
271
public void Add(
Icon
value)
329
else if (original._image is
Icon
originalIcon)
System\Windows\Forms\Controls\ImageList\ImageList.Original.cs (1)
32
if (image is not
Icon
and not Image)
System\Windows\Forms\Controls\Unsupported\StatusBar\StatusBarPanel.cs (1)
55
public
Icon
Icon
System\Windows\Forms\Design\ComponentEditorPage.cs (2)
14
private
Icon
? _icon;
91
public
Icon
Icon
System\Windows\Forms\Dialogs\TaskDialog\TaskDialogFootnote.cs (1)
92
/// <see cref="Drawing.
Icon
"/> (or from a handle pointer)
System\Windows\Forms\Dialogs\TaskDialog\TaskDialogIcon.cs (12)
18
/// created from an <see cref="
Icon
"/> instance (or an icon handle).
95
private readonly
Icon
? _ownedIcon;
106
/// The <see cref="
Icon
"/> instance from which this <see cref="TaskDialogIcon"/>
118
/// <see cref="
Icon
"/> instance.
120
/// <param name="icon">The <see cref="
Icon
"/> instance.</param>
124
/// The <see cref="
Icon
"/> instance from which this <see cref="TaskDialogIcon"/>
129
public TaskDialogIcon(
Icon
icon)
150
private TaskDialogIcon(
Icon
icon, bool takeOwnership)
188
private static
Icon
BitmapToIcon(Bitmap bitmap)
194
var
icon =
Icon
.FromHandle(handle);
196
return (
Icon
)icon.Clone();
System\Windows\Forms\Dialogs\TaskDialog\TaskDialogPage.cs (1)
375
/// <see cref="Drawing.
Icon
"/> (or from a handle pointer)
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
260
using
Icon
icon = SystemIcons.GetStockIcon(stockIconId, _scaledPictureWidth);
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (5)
27
private
Icon
? _icon;
41
private static
Icon
? t_defaultIcon;
541
private static
Icon
DefaultIcon
550
Icon
defaultIcon = new(typeof(ErrorProvider), "Error");
567
public
Icon
Icon
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
458
Icon
icon = _provider.Icon;
System\Windows\Forms\ErrorProvider\ErrorProvider.IconRegion.cs (2)
16
private readonly
Icon
_icon;
18
public IconRegion(
Icon
icon, int currentDpi)
System\Windows\Forms\Form.cs (7)
104
private static
Icon
? s_defaultIcon;
147
private
Icon
? _icon;
148
private
Icon
? _smallIcon;
862
internal static
Icon
DefaultIcon
1003
public
Icon
? Icon
3351
Icon
? icon = Icon;
6337
Icon
? icon;
System\Windows\Forms\MDI\MDIControlStrip.cs (3)
81
Icon
icon = !hIcon.IsNull ?
Icon
.FromHandle(hIcon) : Form.DefaultIcon;
82
using
Icon
smallIcon = new(icon, SystemInformation.SmallIconSize);
System\Windows\Forms\NotifyIcon.cs (2)
36
private
Icon
? _icon;
204
public
Icon
? Icon
System\Windows\Forms\Printing\PrintPreviewDialog.cs (1)
186
public new
Icon
? Icon
System.Windows.Forms.Design (4)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.EditorButton.cs (1)
125
using
Icon
icon = new(typeof(DesignerActionPanel), "Arrow.ico");
System\Drawing\Design\IconEditor.cs (2)
107
protected virtual
Icon
LoadFromStream(Stream stream) => new(stream);
112
if (e?.Value is not
Icon
icon)
System\Windows\Forms\Design\ControlDesigner.cs (1)
2283
using
Icon
err = SystemIcons.GetStockIcon(StockIconId.Error);
System.Windows.Forms.Design.Tests (11)
EnsureEditorsTests.cs (1)
53
[InlineData(typeof(
Icon
), typeof(IconEditor))]
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (8)
400
using
Icon
expected = new(@"Resources\Icon1.ico");
401
ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(
Icon
)));
407
using
Icon
icon = new(SystemIcons.Exclamation, 16, 16);
455
using
Icon
expected = new(@"Resources\Icon1.ico");
456
ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(
Icon
)));
683
private static void ValidateResultIcon(PropertyInfo iconPropertyInfo,
Icon
expected, TypeConverter converter)
686
using
Icon
resourceIcon = Assert.IsType<
Icon
>(converter.ConvertFrom(resourceByte));
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
97
using
Icon
icon = new(stream);
System\Windows\Forms\Design\ImageListImageTests.cs (1)
75
using
Icon
icon = SystemIcons.Application;
System.Windows.Forms.Primitives (4)
System\Drawing\ImageExtensions.cs (1)
27
return (Image)(
Icon
.FromHandle((HICON)handle).Clone());
System\Windows\Forms\Internals\ScaleHelper.cs (3)
350
using
Icon
icon = new(resourceStream, size.IsEmpty ? SystemIconSize : size);
427
internal static
Icon
ScaleSmallIconToDpi(
Icon
icon, int dpi)
System.Windows.Forms.Primitives.Tests (5)
Interop\Ole32\IPictureTests.cs (5)
21
using var picture =
Icon
.FromHandle(arrow.Handle).CreateIPicture(copy: true);
36
using
Icon
icon =
Icon
.FromHandle(arrow.Handle);
52
using
Icon
icon = SystemIcons.Question;
72
using
Icon
icon = SystemIcons.Exclamation;
System.Windows.Forms.Tests (57)
System\Resources\ResXFileRef.ConverterTests.cs (4)
105
var
result = (
Icon
)converter.ConvertFrom(null, null, resxFileRefString);
118
var
iconResult = (
Icon
)converter.ConvertFrom(null, null, iconRefString);
System\Windows\Forms\ComponentModel\Com2Interop\COM2PictureConverterTests.cs (7)
77
Icon
errorIcon = SystemIcons.Error;
82
using
Icon
icon = (
Icon
)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null);
86
Assert.Equal(typeof(
Icon
), Instance.ManagedType);
89
Assert.Same(icon, (
Icon
)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null));
95
Icon
errorIcon = SystemIcons.Error;
140
Icon
exclamationIcon = SystemIcons.Exclamation;
System\Windows\Forms\Design\ComponentEditorPageTests.cs (2)
290
using
var
value =
Icon
.FromHandle(new Bitmap(10, 10).GetHicon());
System\Windows\Forms\EmbeddedResourceTests.cs (1)
209
using
Icon
icon = new(stream);
System\Windows\Forms\ErrorProviderTests.cs (6)
537
yield return new object[] {
Icon
.FromHandle(new Bitmap(10, 10).GetHicon()) };
542
public void ErrorProvider_Icon_Set_GetReturnsExpected(
Icon
value)
563
provider.Icon =
Icon
.FromHandle(new Bitmap(10, 10).GetHicon());
575
provider.Icon =
Icon
.FromHandle(new Bitmap(10, 10).GetHicon());
1332
var
icon = provider.Icon;
1337
using
Icon
newIcon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (6)
654
public void ImageCollection_Add_InvokeStringIcon_Success(Color transparentColor,
Icon
value)
698
public void ImageCollection_Add_InvokeStringIconWithHandle_Success(Color transparentColor,
Icon
value)
743
public void ImageCollection_Add_InvokeIcon_Success(Color transparentColor,
Icon
value)
767
public void ImageCollection_Add_InvokeIconWithHandle_Success(Color transparentColor,
Icon
value)
798
Assert.Throws<ArgumentNullException>("value", () => collection.Add((
Icon
)null));
799
Assert.Throws<InvalidOperationException>(() => collection.Add("Key", (
Icon
)null));
System\Windows\Forms\ImageListTests.cs (2)
832
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
888
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\MdiControlStripTests.cs (3)
332
Icon
largeIcon = (
Icon
)
Icon
.FromHandle(hicon).Clone();
System\Windows\Forms\NotifyIconTests.cs (26)
202
public void NotifyIcon_Icon_Set_GetReturnsExpected(
Icon
value)
217
public void NotifyIcon_Icon_SetWithCustomOldValue_GetReturnsExpected(
Icon
value)
219
using
Icon
oldValue = new(new Icon("bitmaps/10x16_one_entry_32bit.ico"), 10, 10);
235
public void NotifyIcon_Icon_SetWithVisible_GetReturnsExpected(
Icon
value)
257
public void NotifyIcon_Icon_SetDesignMode_GetReturnsExpected(
Icon
value, int expectedDesignModeCallCount)
282
public void NotifyIcon_Icon_SetDesignModeWithVisible_GetReturnsExpected(
Icon
value, int expectedDesignModeCallCount)
311
using
Icon
value = new("bitmaps/10x16_one_entry_32bit.ico");
335
foreach (
Icon
icon in new
Icon
[] { null, new("bitmaps/10x16_one_entry_32bit.ico") })
347
public void CollectionForm_Text_Set_GetReturnsExpected(bool visible,
Icon
icon, string value, string expected)
364
public void CollectionForm_Text_SetWithCustomOldValue_GetReturnsExpected(bool visible,
Icon
icon, string value, string expected)
385
foreach (
Icon
icon in new
Icon
[] { null, new("bitmaps/10x16_one_entry_32bit.ico") })
403
public void CollectionForm_Text_SetDesignMode_GetReturnsExpected(bool visible,
Icon
icon, string value, string expected, int expectedDesignModeCallCount)
437
public void CollectionForm_Text_SetDisposed_GetReturnsExpected(bool visible,
Icon
icon, string value, string expected)
477
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
537
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
761
foreach (
Icon
icon in new
Icon
[] { null, new("bitmaps/10x16_one_entry_32bit.ico") })
770
public void NotifyIcon_Dispose_InvokePropertiesSet_Success(bool visible,
Icon
icon)
839
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
855
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
880
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
906
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
919
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
933
using
Icon
icon = new("bitmaps/10x16_one_entry_32bit.ico");
TestPassApp (1)
PrintingControls.Designer.cs (1)
66
this.printPreviewDialog1.Icon = ((System.Drawing.
Icon
)(resources.GetObject("printPreviewDialog1.Icon")));
WinFormsControlsTest (1)
Buttons.cs (1)
117
Image =
Icon
.ExtractIcon("regedit.exe", 0, 256).ToBitmap()