131 instantiations of Icon
DesignSurface (1)
MainForm.cs (1)
158pb1.Image = new Icon("painter.ico").ToBitmap();
System.Drawing.Common.Tests (65)
mono\System.Drawing\BitmapTests.cs (4)
1197using (Icon icon = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 1215using (Icon icon = new(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico"))) 1233using (Icon icon = new(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico"))) 1251using (Icon icon = new(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")))
System\Drawing\BitmapTests.cs (5)
661yield return new object[] { new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")), 16, 16 }; 662yield return new object[] { new Icon(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")), 32, 32 }; 663yield return new object[] { new Icon(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")), 64, 64 }; 664yield return new object[] { new Icon(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")), 96, 96 }; 767using Icon icon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
System\Drawing\GdiPlusHandlesTests.cs (1)
25using Icon ico = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
System\Drawing\IconConverterTests.cs (1)
21_icon = new Icon(Path.Combine("bitmaps", "TestIcon.ico"));
System\Drawing\IconTests.cs (52)
40using Icon icon = new(Helpers.GetTestBitmapPath(name)); 70using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height); 80using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size); 89AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null)); 90AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null, new Size(32, 32))); 91AssertExtensions.Throws<ArgumentNullException>("path", () => new Icon((string)null, 32, 32)); 98Icon icon = new(stream); 108Icon icon = new(stream); 125using Icon icon = new(stream, size.Width, size.Height); 136using Icon icon = new(stream, size); 145AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null)); 146AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null, 32, 32)); 147AssertExtensions.Throws<ArgumentNullException, ArgumentException>("stream", null, () => new Icon((Stream)null, new Size(32, 32))); 215Assert.Throws(exceptionType, () => new Icon(stream)); 222using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName)); 223using Icon icon = new(sourceIcon, size.Width, size.Height); 234using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName)); 235using Icon icon = new(sourceIcon, size); 245AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, 32, 32)); 246AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, new Size(32, 32))); 252using Icon icon = new(typeof(IconTests), "48x48_multiple_entries_4bit.ico"); 260Assert.Throws<NullReferenceException>(() => new Icon(null, "48x48_multiple_entries_4bit.ico")); 269AssertExtensions.Throws<ArgumentException>(null, () => new Icon(type, resource)); 275AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new Icon(typeof(Icon), null)); 281using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 305Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 322using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 337using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size); 425SaveAndCompare(new Icon(Helpers.GetTestBitmapPath(fileName)), true); 432using Icon icon = new(filePath); 442Icon icon = new(filePath); 452using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 459using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 469using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 479using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 507yield return new object[] { new Icon(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")) }; 508yield return new object[] { new Icon(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico")) }; 509yield return new object[] { new Icon(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico")) }; 510yield return new object[] { new Icon(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico")) }; 511yield return new object[] { new Icon(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")) }; 512yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 48, 48) }; 513yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 256, 256) }; 514yield return new object[] { new Icon(Helpers.GetTestBitmapPath("256x256_two_entries_multiple_bits.ico"), 0, 0) }; 544using Icon originalIcon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico")); 630return new Icon(stream); 636using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")); 646using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")); 664using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 679using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 706Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 720using Icon loaded = new(outputStream); 751using Icon icon = new(stream, new Size(32, 32));
System\Drawing\ImageConverterTests.cs (1)
38using Icon icon = new(Helpers.GetTestBitmapPath(name));
System\Drawing\TextureBrushTests.cs (1)
41using Icon icon = new(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico"));
System.Windows.Forms (10)
System\Resources\ResxFileRef.Converter.cs (1)
142Icon ico = new(memoryStream);
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (1)
78internal static Icon ErrorIcon => s_errorIcon ??= new Icon(typeof(DataGridView), "IconInError");
System\Windows\Forms\Design\ComponentEditorPage.cs (1)
93get => _icon ??= new Icon(typeof(ComponentEditorPage), "ComponentEditorPage");
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (2)
552using Icon defaultIcon = new(typeof(ErrorProvider), "Error"); 553t_defaultIcon = new Icon(defaultIcon, width, height);
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
458_provider.Icon = new Icon(icon, (int)(icon.Width * factor), (int)(icon.Height * factor));
System\Windows\Forms\ErrorProvider\ErrorProvider.IconRegion.cs (1)
20_icon = new Icon(icon, ScaleHelper.LogicalSmallSystemIconSize);
System\Windows\Forms\Form.cs (2)
872s_defaultIcon ??= new Icon(typeof(Form), "wfc"); 6356_smallIcon = new Icon(icon, SystemInformation.SmallIconSize);
System\Windows\Forms\MDI\MDIControlStrip.cs (1)
82using Icon smallIcon = new(icon, SystemInformation.SmallIconSize);
System.Windows.Forms.Design (21)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.EditorButton.cs (1)
125using Icon icon = new(typeof(DesignerActionPanel), "Arrow.ico");
System\Drawing\Design\IconEditor.cs (1)
107protected 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)
54return 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)
410image = new Icon(typeof(ToolStripMenuItem), "new").ToBitmap(); 414image = new Icon(typeof(ToolStripMenuItem), "open").ToBitmap(); 418image = new Icon(typeof(ToolStripMenuItem), "save").ToBitmap(); 422image = new Icon(typeof(ToolStripMenuItem), "printPreview").ToBitmap(); 426image = new Icon(typeof(ToolStripMenuItem), "print").ToBitmap(); 430image = new Icon(typeof(ToolStripMenuItem), "cut").ToBitmap(); 434image = new Icon(typeof(ToolStripMenuItem), "copy").ToBitmap(); 438image = new Icon(typeof(ToolStripMenuItem), "paste").ToBitmap(); 442image = new Icon(typeof(ToolStripMenuItem), "help").ToBitmap();
System\Windows\Forms\Design\TemplateNodeCustomMenuItemCollection.cs (1)
88image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
616image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripItemCustomMenuItemCollection.cs (4)
75item.Image = new Icon(typeof(ToolStripMenuItem), imageName).ToBitmap(); 123Image = new Icon(typeof(ToolStripMenuItem), "image").ToBitmap(), 218_editItemsToolStripMenuItem.Image = new Icon(typeof(ToolStripMenuItem), "editdropdownlist").ToBitmap(); 533image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
System\Windows\Forms\Design\ToolStripItemDesigner.cs (1)
818image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
System.Windows.Forms.Design.Tests (4)
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (3)
398using Icon expected = new(@"Resources\Icon1.ico"); 405using Icon icon = new(SystemIcons.Exclamation, 16, 16); 453using Icon expected = new(@"Resources\Icon1.ico");
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
95using Icon icon = new(stream);
System.Windows.Forms.Primitives (1)
System\Windows\Forms\Internals\ScaleHelper.cs (1)
350using Icon icon = new(resourceStream, size.IsEmpty ? SystemIconSize : size);
System.Windows.Forms.Tests (29)
System\Windows\Forms\EmbeddedResourceTests.cs (1)
207using Icon icon = new(stream);
System\Windows\Forms\ErrorProviderTests.cs (1)
1335using Icon newIcon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (5)
646yield return new object[] { transparentColor, new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1746yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1777yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1797yield return new object[] { index, new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1829yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") };
System\Windows\Forms\ImageListTests.cs (2)
830using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 886using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\NotifyIconTests.cs (20)
195yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 217using Icon oldValue = new(new Icon("bitmaps/10x16_one_entry_32bit.ico"), 10, 10); 250yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico"), 1 }; 309using Icon value = new("bitmaps/10x16_one_entry_32bit.ico"); 333foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 383foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 393yield return new object[] { false, new Icon("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 0 }; 394yield return new object[] { false, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 0 }; 395yield return new object[] { true, new Icon("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 1 }; 396yield return new object[] { true, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 1 }; 475using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 535using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 759foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 837using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 853using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 878using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 904using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 917using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 931using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
293 references to Icon
Accessibility_Core_App (1)
PrintingControls.Designer.cs (1)
66this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
DesignSurface (1)
MainForm.Designer.cs (1)
299this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
Interactive\NavigateTo\InteractiveNavigateToTests.cs (1)
471var unused = itemDisplay.Glyph;
NavigateTo\NavigateToTests.cs (1)
672var unused = itemDisplay.Glyph;
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
NavigateTo\NavigateToItemDisplay.cs (1)
105public Icon Glyph => null;
PresentationUI (13)
artifacts\obj\PresentationUI\Debug\net9.0\MS.Internal.Documents.Resources.cs (8)
64internal static System.Drawing.Icon DocumentApplication { 67return ((System.Drawing.Icon)(obj)); 114internal static System.Drawing.Icon RMPublishingEveryone { 117return ((System.Drawing.Icon)(obj)); 124internal static System.Drawing.Icon RMPublishingPeoplePicker { 127return ((System.Drawing.Icon)(obj)); 134internal static System.Drawing.Icon RMPublishingRemove { 137return ((System.Drawing.Icon)(obj));
MS\Internal\Documents\DialogBaseForm.cs (1)
79Icon = (System.Drawing.Icon)Resources.DocumentApplication;
MS\Internal\Documents\RMPublishingDialog.cs (4)
499private void SetupIconButton(Button button, Icon icon, string text, string tooltip) 942(System.Drawing.Icon)Resources.RMPublishingPeoplePicker, 947(System.Drawing.Icon)Resources.RMPublishingEveryone, 952(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 (17)
Special\NotSupported.cs (17)
486public void DrawIcon(System.Drawing.Icon icon, System.Drawing.Rectangle targetRect) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 487public void DrawIcon(System.Drawing.Icon icon, int x, int y) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 488public void DrawIconUnstretched(System.Drawing.Icon icon, System.Drawing.Rectangle targetRect) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 699public Icon(System.Drawing.Icon original, System.Drawing.Size size) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 700public Icon(System.Drawing.Icon original, int width, int height) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 717public static System.Drawing.Icon? ExtractAssociatedIcon(string filePath) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 719public static System.Drawing.Icon FromHandle(System.IntPtr handle) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 1280public static System.Drawing.Icon Application { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1281public static System.Drawing.Icon Asterisk { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1282public static System.Drawing.Icon Error { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1283public static System.Drawing.Icon Exclamation { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1284public static System.Drawing.Icon Hand { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1285public static System.Drawing.Icon Information { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1286public static System.Drawing.Icon Question { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1287public static System.Drawing.Icon Shield { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1288public static System.Drawing.Icon Warning { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 1289public static System.Drawing.Icon WinLogo { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } }
System.Drawing.Common.Tests (113)
mono\System.Drawing\BitmapTests.cs (4)
1197using (Icon icon = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 1215using (Icon icon = new(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico"))) 1233using (Icon icon = new(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico"))) 1251using (Icon icon = new(Helpers.GetTestBitmapPath("96x96_one_entry_8bit.ico")))
System\Drawing\BitmapTests.cs (2)
669public void FromHicon_IconHandle_ReturnsExpected(Icon icon, int width, int height) 767using Icon icon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico"));
System\Drawing\GdiPlusHandlesTests.cs (1)
25using Icon ico = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"));
System\Drawing\IconConverterTests.cs (4)
13private readonly Icon _icon; 107Icon newIcon = (Icon)_icoConv.ConvertFrom(null, CultureInfo.InvariantCulture, _iconBytes); 119newIcon = (Icon)_icoConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, _iconBytes);
System\Drawing\IconTests.cs (92)
40using Icon icon = new(Helpers.GetTestBitmapPath(name)); 70using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size.Width, size.Height); 80using Icon icon = new(Helpers.GetTestBitmapPath(fileName), size); 98Icon icon = new(stream); 108Icon icon = new(stream); 125using Icon icon = new(stream, size.Width, size.Height); 136using Icon icon = new(stream, size); 222using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName)); 223using Icon icon = new(sourceIcon, size.Width, size.Height); 234using Icon sourceIcon = new(Helpers.GetTestBitmapPath(fileName)); 235using Icon icon = new(sourceIcon, size); 245AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, 32, 32)); 246AssertExtensions.Throws<ArgumentNullException, ArgumentException>("original", null, () => new Icon((Icon)null, new Size(32, 32))); 252using Icon icon = new(typeof(IconTests), "48x48_multiple_entries_4bit.ico"); 264[InlineData(typeof(Icon), "")] 265[InlineData(typeof(Icon), "48x48_multiple_entries_4bit.ico")] 275AssertExtensions.Throws<ArgumentNullException, ArgumentException>("resource", null, () => new Icon(typeof(Icon), null)); 281using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 282using Icon clone = Assert.IsType<Icon>(icon.Clone()); 293using var icon = Icon.FromHandle(SystemIcons.Hand.Handle); 294using Icon clone = Assert.IsType<Icon>(icon.Clone()); 305Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 313Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 322using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 323using var icon = Icon.FromHandle(source.Handle); 337using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_32bit.ico"), size, size); 379using Icon icon = Icon.ExtractAssociatedIcon(filePath); 390Assert.Null(Icon.ExtractAssociatedIcon("http://microsoft.com")); 394Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("http://microsoft.com")); 401AssertExtensions.Throws<ArgumentNullException, ArgumentException>("filePath", null, () => Icon.ExtractAssociatedIcon(null)); 407AssertExtensions.Throws<ArgumentException>("filePath", null, () => Icon.ExtractAssociatedIcon("")); 413Assert.Throws<FileNotFoundException>(() => Icon.ExtractAssociatedIcon("no-such-file.png")); 432using Icon icon = new(filePath); 442Icon icon = new(filePath); 452using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 459using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 460var icon = Icon.FromHandle(source.Handle); 469using Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 479using Icon source = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 480using var icon = Icon.FromHandle(source.Handle); 499Icon icon = Icon.ExtractAssociatedIcon(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 519public void ToBitmap_BitmapIcon_ReturnsExpected(Icon icon) 544using Icon originalIcon = new(Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico")); 545using Icon icon = Icon.FromHandle(originalIcon.Handle); 556using Icon icon = GetPngIcon(); 591using Icon icon = GetPngIcon(); 610private static Icon GetPngIcon() 636using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")); 637using Icon icon2 = Icon.FromHandle(icon1.Handle); 646using Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico")); 647using (Icon icon2 = Icon.FromHandle(icon1.Handle)) 654using Icon icon3 = Icon.FromHandle(icon1.Handle); 664using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 669using Icon icon2 = Icon.FromHandle(handle); 679using (Icon icon1 = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 684using (Icon icon2 = Icon.FromHandle(handle)) 691using Icon icon3 = Icon.FromHandle(handle); 700AssertExtensions.Throws<ArgumentException>("handle", null, () => Icon.FromHandle(IntPtr.Zero)); 706Icon icon = new(Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico")); 714private static void SaveAndCompare(Icon icon, bool alpha) 720using Icon loaded = new(outputStream); 751using Icon icon = new(stream, new Size(32, 32)); 758FieldInfo fi = typeof(Icon).GetField(fieldName, BindingFlags.Static | BindingFlags.NonPublic); 786Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0, 16); }); 787Assert.Throws<ArgumentNullException>(() => { Icon.ExtractIcon(null!, 0); }); 793Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0, 16); }); 794Assert.Throws<IOException>(() => { Icon.ExtractIcon(string.Empty, 0); }); 804Assert.Throws<ArgumentOutOfRangeException>(() => { Icon.ExtractIcon("Foo", 0, size); }); 812Icon.ExtractIcon(Path.GetRandomFileName() + ".ico", 0, 16); 817Icon.ExtractIcon(Path.GetRandomFileName() + ".ico", 0); 825Assert.Null(Icon.ExtractIcon(file.Path, 0, 16)); 826Assert.Null(Icon.ExtractIcon(file.Path, 0)); 832Icon? icon; 834while ((icon = Icon.ExtractIcon("regedit.exe", count, 16)) is not null) 850using Icon? icon = Icon.ExtractIcon("regedit.exe", -100, 256);
System\Drawing\ImageConverterTests.cs (3)
38using Icon icon = new(Helpers.GetTestBitmapPath(name)); 64Assert.True(_imgConv.CanConvertFrom(typeof(Icon)), "Icon (no context)"); 65Assert.True(_imgConv.CanConvertFrom(null, typeof(Icon)), "Icon");
System\Drawing\SystemIconsTests.cs (6)
22public static object[] Icon(Func<Icon> getIcon) => [getIcon]; 26public void SystemIcons_Get_ReturnsExpected(Func<Icon> getIcon) 28Icon icon = getIcon(); 36using Icon icon = SystemIcons.GetStockIcon(stockIcon); 43using Icon icon = SystemIcons.GetStockIcon(StockIconId.Lock, size: 256); 68using Icon icon = SystemIcons.GetStockIcon(StockIconId.Shield, options);
System\Drawing\TextureBrushTests.cs (1)
41using Icon icon = new(Helpers.GetTestBitmapPath("10x16_one_entry_32bit.ico"));
System.Windows.Forms (64)
System\Drawing\Design\UITypeEditor.cs (1)
57[typeof(Icon)] = $"System.Drawing.Design.IconEditor, {AssemblyRef.SystemDrawingDesign}",
System\Resources\ResxFileRef.Converter.cs (1)
142Icon ico = new(memoryStream);
System\Windows\Forms\ActiveX\AxHost.cs (1)
3570=> cursor is null ? null : IPicture.CreateObjectFromIcon(Icon.FromHandle(cursor.Handle), copy: true);
System\Windows\Forms\ComponentModel\COM2Interop\COM2PictureConverter.cs (4)
26_pictureType = typeof(Icon); 65_pictureType = typeof(Icon); 66_lastManaged = Icon.FromHandle(extendedHandle); 104if (managedValue is Icon icon)
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (9)
16private static readonly Type s_defaultTypeIcon = typeof(Icon); 19private static Icon? s_errorIcon; 78internal static Icon ErrorIcon => s_errorIcon ??= new Icon(typeof(DataGridView), "IconInError"); 377if (formattedValue is not Icon ico) 415Icon? ico = null; 418ico = formattedValue as Icon; 556Icon? icon = owningImageColumn.Icon; 783Icon? icon = image is null ? formattedValue as Icon : null;
System\Windows\Forms\Controls\DataGridView\DataGridViewImageColumn.cs (3)
15private Icon? _icon; 108public Icon? Icon 228DefaultCellStyle.NullValue is Icon icon &&
System\Windows\Forms\Controls\ImageList\ImageList.cs (3)
293else if (original._image is Icon originalIcon) 348private int AddIconToHandle(Original original, Icon icon) 440if (original._image is Icon originalIcon)
System\Windows\Forms\Controls\ImageList\ImageList.ImageCollection.cs (3)
245public void Add(string key, Icon icon) 271public void Add(Icon value) 329else if (original._image is Icon originalIcon)
System\Windows\Forms\Controls\ImageList\ImageList.Original.cs (1)
32if (image is not Icon and not Image)
System\Windows\Forms\Design\ComponentEditorPage.cs (2)
14private Icon? _icon; 91public 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). 95private 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"/> 129public TaskDialogIcon(Icon icon) 150private TaskDialogIcon(Icon icon, bool takeOwnership) 188private static Icon BitmapToIcon(Bitmap bitmap) 194var icon = Icon.FromHandle(handle); 196return (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)
252using Icon icon = SystemIcons.GetStockIcon(stockIconId, _scaledPictureWidth);
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (5)
27private Icon _icon = DefaultIcon; 40private static Icon? t_defaultIcon; 541private static Icon DefaultIcon 552using Icon defaultIcon = new(typeof(ErrorProvider), "Error"); 569public Icon Icon
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
457using Icon icon = _provider.Icon;
System\Windows\Forms\ErrorProvider\ErrorProvider.IconRegion.cs (2)
16private readonly Icon _icon; 18public IconRegion(Icon icon)
System\Windows\Forms\Form.cs (7)
104private static Icon? s_defaultIcon; 147private Icon? _icon; 148private Icon? _smallIcon; 862internal static Icon DefaultIcon 1003public Icon? Icon 3351Icon? icon = Icon; 6337Icon? icon;
System\Windows\Forms\MDI\MDIControlStrip.cs (3)
81Icon icon = !hIcon.IsNull ? Icon.FromHandle(hIcon) : Form.DefaultIcon; 82using Icon smallIcon = new(icon, SystemInformation.SmallIconSize);
System\Windows\Forms\NotifyIcon.cs (2)
36private Icon? _icon; 204public Icon? Icon
System\Windows\Forms\Printing\PrintPreviewDialog.cs (1)
186public new Icon? Icon
System.Windows.Forms.Design (4)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.EditorButton.cs (1)
125using Icon icon = new(typeof(DesignerActionPanel), "Arrow.ico");
System\Drawing\Design\IconEditor.cs (2)
107protected virtual Icon LoadFromStream(Stream stream) => new(stream); 112if (e?.Value is not Icon icon)
System\Windows\Forms\Design\ControlDesigner.cs (1)
2285using Icon err = SystemIcons.GetStockIcon(StockIconId.Error);
System.Windows.Forms.Design.Tests (11)
EnsureEditorsTests.cs (1)
51[InlineData(typeof(Icon), typeof(IconEditor))]
System\Resources\Tools\StronglyTypedResourceBuilderTests.cs (8)
398using Icon expected = new(@"Resources\Icon1.ico"); 399ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(Icon))); 405using Icon icon = new(SystemIcons.Exclamation, 16, 16); 453using Icon expected = new(@"Resources\Icon1.ico"); 454ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(Icon))); 681private static void ValidateResultIcon(PropertyInfo iconPropertyInfo, Icon expected, TypeConverter converter) 684using Icon resourceIcon = Assert.IsType<Icon>(converter.ConvertFrom(resourceByte));
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
95using Icon icon = new(stream);
System\Windows\Forms\Design\ImageListImageTests.cs (1)
77using Icon icon = SystemIcons.Application;
System.Windows.Forms.Primitives (2)
System\Drawing\ImageExtensions.cs (1)
27return (Image)(Icon.FromHandle((HICON)handle).Clone());
System\Windows\Forms\Internals\ScaleHelper.cs (1)
350using Icon icon = new(resourceStream, size.IsEmpty ? SystemIconSize : size);
System.Windows.Forms.Primitives.Tests (5)
Interop\Ole32\IPictureTests.cs (5)
20using var picture = IPicture.CreateFromIcon(Icon.FromHandle(arrow.Handle), copy: true); 35using Icon icon = Icon.FromHandle(arrow.Handle); 51using Icon icon = SystemIcons.Question; 71using Icon icon = SystemIcons.Exclamation;
System.Windows.Forms.Tests (57)
System\Resources\ResXFileRef.ConverterTests.cs (4)
103var result = (Icon)converter.ConvertFrom(null, null, resxFileRefString); 116var iconResult = (Icon)converter.ConvertFrom(null, null, iconRefString);
System\Windows\Forms\ComponentModel\Com2Interop\COM2PictureConverterTests.cs (7)
75Icon errorIcon = SystemIcons.Error; 80using Icon icon = (Icon)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null); 84Assert.Equal(typeof(Icon), Instance.ManagedType); 87Assert.Same(icon, (Icon)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null)); 93Icon errorIcon = SystemIcons.Error; 138Icon exclamationIcon = SystemIcons.Exclamation;
System\Windows\Forms\Design\ComponentEditorPageTests.cs (2)
288using var value = Icon.FromHandle(new Bitmap(10, 10).GetHicon());
System\Windows\Forms\EmbeddedResourceTests.cs (1)
207using Icon icon = new(stream);
System\Windows\Forms\ErrorProviderTests.cs (6)
535yield return new object[] { Icon.FromHandle(new Bitmap(10, 10).GetHicon()) }; 540public void ErrorProvider_Icon_Set_GetReturnsExpected(Icon value) 561provider.Icon = Icon.FromHandle(new Bitmap(10, 10).GetHicon()); 573provider.Icon = Icon.FromHandle(new Bitmap(10, 10).GetHicon()); 1330var icon = provider.Icon; 1335using Icon newIcon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (6)
652public void ImageCollection_Add_InvokeStringIcon_Success(Color transparentColor, Icon value) 696public void ImageCollection_Add_InvokeStringIconWithHandle_Success(Color transparentColor, Icon value) 741public void ImageCollection_Add_InvokeIcon_Success(Color transparentColor, Icon value) 765public void ImageCollection_Add_InvokeIconWithHandle_Success(Color transparentColor, Icon value) 796Assert.Throws<ArgumentNullException>("value", () => collection.Add((Icon)null)); 797Assert.Throws<InvalidOperationException>(() => collection.Add("Key", (Icon)null));
System\Windows\Forms\ImageListTests.cs (2)
830using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 886using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\MdiControlStripTests.cs (3)
330Icon largeIcon = (Icon)Icon.FromHandle(hicon).Clone();
System\Windows\Forms\NotifyIconTests.cs (26)
200public void NotifyIcon_Icon_Set_GetReturnsExpected(Icon value) 215public void NotifyIcon_Icon_SetWithCustomOldValue_GetReturnsExpected(Icon value) 217using Icon oldValue = new(new Icon("bitmaps/10x16_one_entry_32bit.ico"), 10, 10); 233public void NotifyIcon_Icon_SetWithVisible_GetReturnsExpected(Icon value) 255public void NotifyIcon_Icon_SetDesignMode_GetReturnsExpected(Icon value, int expectedDesignModeCallCount) 280public void NotifyIcon_Icon_SetDesignModeWithVisible_GetReturnsExpected(Icon value, int expectedDesignModeCallCount) 309using Icon value = new("bitmaps/10x16_one_entry_32bit.ico"); 333foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 345public void CollectionForm_Text_Set_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 362public void CollectionForm_Text_SetWithCustomOldValue_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 383foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 401public void CollectionForm_Text_SetDesignMode_GetReturnsExpected(bool visible, Icon icon, string value, string expected, int expectedDesignModeCallCount) 435public void CollectionForm_Text_SetDisposed_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 475using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 535using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 759foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 768public void NotifyIcon_Dispose_InvokePropertiesSet_Success(bool visible, Icon icon) 837using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 853using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 878using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 904using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 917using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 931using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
WinFormsControlsTest (1)
Buttons.cs (1)
117Image = Icon.ExtractIcon("regedit.exe", 0, 256).ToBitmap()