130 instantiations of Icon
DesignSurface (1)
MainForm.cs (1)
166pb1.Image = new Icon("painter.ico").ToBitmap();
System.Drawing.Common.Tests (65)
mono\System.Drawing\BitmapTests.cs (4)
1191using (Icon icon = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 1209using (Icon icon = new(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico"))) 1227using (Icon icon = new(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico"))) 1245using (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.Join("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 (8)
System\Resources\ResxFileRef.Converter.cs (1)
141Icon 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 (1)
550Icon 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)
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)
610image = 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)
400using Icon expected = new(@"Resources\Icon1.ico"); 407using Icon icon = new(SystemIcons.Exclamation, 16, 16); 455using Icon expected = new(@"Resources\Icon1.ico");
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
97using Icon icon = new(stream);
System.Windows.Forms.Primitives (2)
System\Windows\Forms\Internals\ScaleHelper.cs (2)
350using Icon icon = new(resourceStream, size.IsEmpty ? SystemIconSize : size); 432return (icon.Width == width && icon.Height == height) ? icon : new(icon, width, height);
System.Windows.Forms.Tests (29)
System\Windows\Forms\EmbeddedResourceTests.cs (1)
209using Icon icon = new(stream);
System\Windows\Forms\ErrorProviderTests.cs (1)
1337using Icon newIcon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (5)
648yield return new object[] { transparentColor, new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1748yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1779yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1799yield return new object[] { index, new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 1831yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") };
System\Windows\Forms\ImageListTests.cs (2)
832using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 888using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\NotifyIconTests.cs (20)
197yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico") }; 219using Icon oldValue = new(new Icon("bitmaps/10x16_one_entry_32bit.ico"), 10, 10); 252yield return new object[] { new Icon("bitmaps/10x16_one_entry_32bit.ico"), 1 }; 311using Icon value = new("bitmaps/10x16_one_entry_32bit.ico"); 335foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 385foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 395yield return new object[] { false, new Icon("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 0 }; 396yield return new object[] { false, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 0 }; 397yield return new object[] { true, new Icon("bitmaps/10x16_one_entry_32bit.ico"), "text", "text", 1 }; 398yield return new object[] { true, new Icon("bitmaps/10x16_one_entry_32bit.ico"), new string('a', NotifyIcon.MaxTextSize), new string('a', NotifyIcon.MaxTextSize), 1 }; 477using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 537using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 761foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 839using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 855using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 880using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 906using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 919using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 933using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
276 references to Icon
DesignSurface (1)
MainForm.Designer.cs (1)
297this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
PresentationUI (13)
artifacts\obj\PresentationUI\x86\Debug\net10.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)
491private 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)
1191using (Icon icon = new(Helpers.GetTestBitmapPath("16x16_one_entry_4bit.ico"))) 1209using (Icon icon = new(Helpers.GetTestBitmapPath("32x32_one_entry_4bit.ico"))) 1227using (Icon icon = new(Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico"))) 1245using (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 (65)
System\Drawing\Design\UITypeEditor.cs (1)
57[typeof(Icon)] = $"System.Drawing.Design.IconEditor, {(Assemblies.SystemDrawingDesign)}",
System\Resources\ResxFileRef.Converter.cs (1)
141Icon 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); 105if (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\Controls\Unsupported\StatusBar\StatusBarPanel.cs (1)
55public Icon Icon
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)
260using Icon icon = SystemIcons.GetStockIcon(stockIconId, _scaledPictureWidth);
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (5)
27private Icon? _icon; 41private static Icon? t_defaultIcon; 541private static Icon DefaultIcon 550Icon defaultIcon = new(typeof(ErrorProvider), "Error"); 567public Icon Icon
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
458Icon icon = _provider.Icon;
System\Windows\Forms\ErrorProvider\ErrorProvider.IconRegion.cs (2)
16private readonly Icon _icon; 18public IconRegion(Icon icon, int currentDpi)
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)
2283using 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)
400using Icon expected = new(@"Resources\Icon1.ico"); 401ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(Icon))); 407using Icon icon = new(SystemIcons.Exclamation, 16, 16); 455using Icon expected = new(@"Resources\Icon1.ico"); 456ValidateResultIcon(iconPropertyInfo, expected, TypeDescriptor.GetConverter(typeof(Icon))); 683private static void ValidateResultIcon(PropertyInfo iconPropertyInfo, Icon expected, TypeConverter converter) 686using Icon resourceIcon = Assert.IsType<Icon>(converter.ConvertFrom(resourceByte));
System\Windows\Forms\Design\EmbeddedResourceTests.cs (1)
97using Icon icon = new(stream);
System\Windows\Forms\Design\ImageListImageTests.cs (1)
75using Icon icon = SystemIcons.Application;
System.Windows.Forms.Primitives (4)
System\Drawing\ImageExtensions.cs (1)
27return (Image)(Icon.FromHandle((HICON)handle).Clone());
System\Windows\Forms\Internals\ScaleHelper.cs (3)
350using Icon icon = new(resourceStream, size.IsEmpty ? SystemIconSize : size); 427internal static Icon ScaleSmallIconToDpi(Icon icon, int dpi)
System.Windows.Forms.Primitives.Tests (5)
Interop\Ole32\IPictureTests.cs (5)
21using var picture = Icon.FromHandle(arrow.Handle).CreateIPicture(copy: true); 36using Icon icon = Icon.FromHandle(arrow.Handle); 52using Icon icon = SystemIcons.Question; 72using Icon icon = SystemIcons.Exclamation;
System.Windows.Forms.Tests (57)
System\Resources\ResXFileRef.ConverterTests.cs (4)
105var result = (Icon)converter.ConvertFrom(null, null, resxFileRefString); 118var iconResult = (Icon)converter.ConvertFrom(null, null, iconRefString);
System\Windows\Forms\ComponentModel\Com2Interop\COM2PictureConverterTests.cs (7)
77Icon errorIcon = SystemIcons.Error; 82using Icon icon = (Icon)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null); 86Assert.Equal(typeof(Icon), Instance.ManagedType); 89Assert.Same(icon, (Icon)Instance.ConvertNativeToManaged((VARIANT)unknown.Value, null)); 95Icon errorIcon = SystemIcons.Error; 140Icon exclamationIcon = SystemIcons.Exclamation;
System\Windows\Forms\Design\ComponentEditorPageTests.cs (2)
290using var value = Icon.FromHandle(new Bitmap(10, 10).GetHicon());
System\Windows\Forms\EmbeddedResourceTests.cs (1)
209using Icon icon = new(stream);
System\Windows\Forms\ErrorProviderTests.cs (6)
537yield return new object[] { Icon.FromHandle(new Bitmap(10, 10).GetHicon()) }; 542public void ErrorProvider_Icon_Set_GetReturnsExpected(Icon value) 563provider.Icon = Icon.FromHandle(new Bitmap(10, 10).GetHicon()); 575provider.Icon = Icon.FromHandle(new Bitmap(10, 10).GetHicon()); 1332var icon = provider.Icon; 1337using Icon newIcon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\ImageList.ImageCollectionTests.cs (6)
654public void ImageCollection_Add_InvokeStringIcon_Success(Color transparentColor, Icon value) 698public void ImageCollection_Add_InvokeStringIconWithHandle_Success(Color transparentColor, Icon value) 743public void ImageCollection_Add_InvokeIcon_Success(Color transparentColor, Icon value) 767public void ImageCollection_Add_InvokeIconWithHandle_Success(Color transparentColor, Icon value) 798Assert.Throws<ArgumentNullException>("value", () => collection.Add((Icon)null)); 799Assert.Throws<InvalidOperationException>(() => collection.Add("Key", (Icon)null));
System\Windows\Forms\ImageListTests.cs (2)
832using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 888using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
System\Windows\Forms\MdiControlStripTests.cs (3)
332Icon largeIcon = (Icon)Icon.FromHandle(hicon).Clone();
System\Windows\Forms\NotifyIconTests.cs (26)
202public void NotifyIcon_Icon_Set_GetReturnsExpected(Icon value) 217public void NotifyIcon_Icon_SetWithCustomOldValue_GetReturnsExpected(Icon value) 219using Icon oldValue = new(new Icon("bitmaps/10x16_one_entry_32bit.ico"), 10, 10); 235public void NotifyIcon_Icon_SetWithVisible_GetReturnsExpected(Icon value) 257public void NotifyIcon_Icon_SetDesignMode_GetReturnsExpected(Icon value, int expectedDesignModeCallCount) 282public void NotifyIcon_Icon_SetDesignModeWithVisible_GetReturnsExpected(Icon value, int expectedDesignModeCallCount) 311using Icon value = new("bitmaps/10x16_one_entry_32bit.ico"); 335foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 347public void CollectionForm_Text_Set_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 364public void CollectionForm_Text_SetWithCustomOldValue_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 385foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 403public void CollectionForm_Text_SetDesignMode_GetReturnsExpected(bool visible, Icon icon, string value, string expected, int expectedDesignModeCallCount) 437public void CollectionForm_Text_SetDisposed_GetReturnsExpected(bool visible, Icon icon, string value, string expected) 477using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 537using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 761foreach (Icon icon in new Icon[] { null, new("bitmaps/10x16_one_entry_32bit.ico") }) 770public void NotifyIcon_Dispose_InvokePropertiesSet_Success(bool visible, Icon icon) 839using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 855using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 880using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 906using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 919using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico"); 933using Icon icon = new("bitmaps/10x16_one_entry_32bit.ico");
TestPassApp (1)
PrintingControls.Designer.cs (1)
66this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
WinFormsControlsTest (1)
Buttons.cs (1)
117Image = Icon.ExtractIcon("regedit.exe", 0, 256).ToBitmap()