43 instantiations of Icon
System.Drawing.Common (13)
System\Drawing\Icon.cs (6)
181return !hIcon.IsNull ? new Icon(hIcon, takeOwnership: true) : null; 236public object Clone() => new Icon(this, Size.Width, Size.Height); 398return new Icon((HICON)handle); 818/// Unlike the <see cref="Icon(string)">constructors that take a path</see> this method and the 824/// Without the original source data the <see cref="Icon(Icon, Size)">copy constructors</see> have to resample 902return new Icon(hicon, takeOwnership: true);
System\Drawing\IconConverter.cs (1)
25return value is byte[] bytes ? new Icon(new MemoryStream(bytes)) : base.ConvertFrom(context, culture, value);
System\Drawing\SystemIcons.cs (4)
40public static Icon Shield => s_shield ??= new Icon(typeof(SystemIcons), "ShieldIcon.ico"); 43icon ??= new Icon(PInvokeCore.LoadIcon(HINSTANCE.Null, iconId)); 78return new Icon(info.hIcon, takeOwnership: true); 115return new Icon(hicon, takeOwnership: true);
System\Drawing\ToolboxBitmapAttribute.cs (2)
129using Icon ico = new(stream); 130using Icon sizedIco = new(ico, large ? s_largeSize : s_smallSize);
System.Windows.Forms (7)
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)
542Icon defaultIcon = new(typeof(ErrorProvider), "Error");
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
454_provider.Icon = new Icon(icon, (int)(icon.Width * factor), (int)(icon.Height * factor));
System\Windows\Forms\Form.cs (1)
868s_defaultIcon ??= new Icon(typeof(Form), "wfc");
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)
395image = new Icon(typeof(ToolStripMenuItem), "new").ToBitmap(); 399image = new Icon(typeof(ToolStripMenuItem), "open").ToBitmap(); 403image = new Icon(typeof(ToolStripMenuItem), "save").ToBitmap(); 407image = new Icon(typeof(ToolStripMenuItem), "printPreview").ToBitmap(); 411image = new Icon(typeof(ToolStripMenuItem), "print").ToBitmap(); 415image = new Icon(typeof(ToolStripMenuItem), "cut").ToBitmap(); 419image = new Icon(typeof(ToolStripMenuItem), "copy").ToBitmap(); 423image = new Icon(typeof(ToolStripMenuItem), "paste").ToBitmap(); 427image = 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)
571image = 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)
797image = new Icon(typeof(ToolStripButton), "blank").ToBitmap();
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 && !alwaysCreateNew) ? icon : new(icon, width, height);
148 references to Icon
PresentationUI (13)
MS\Internal\Documents\DialogBaseForm.cs (1)
78Icon = (System.Drawing.Icon)Resources.DocumentApplication;
MS\Internal\Documents\RMPublishingDialog.cs (4)
490private void SetupIconButton(Button button, Icon icon, string text, string tooltip) 927(System.Drawing.Icon)Resources.RMPublishingPeoplePicker, 932(System.Drawing.Icon)Resources.RMPublishingEveryone, 937(System.Drawing.Icon)Resources.RMPublishingRemove,
src\wpf\artifacts\obj\PresentationUI\x64\Release\net11.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));
System.Drawing (1)
System.Drawing.cs (1)
62[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Icon))]
System.Drawing.Common (56)
System\Drawing\Graphics.cs (3)
2879public void DrawIcon(Icon icon, int x, int y) 2902public void DrawIcon(Icon icon, Rectangle targetRect) 2925public void DrawIconUnstretched(Icon icon, Rectangle targetRect)
System\Drawing\Icon.cs (20)
48throw new ArgumentException(SR.Format(SR.InvalidGDIHandle, nameof(Icon))); 74public Icon(Icon original, Size size) : this(original, size.Width, size.Height) 78public Icon(Icon original, int width, int height) : this() 149public static Icon? ExtractAssociatedIcon(string filePath) => ExtractAssociatedIcon(filePath, 0); 151private static Icon? ExtractAssociatedIcon(string filePath, int index) 393public static Icon FromHandle(IntPtr handle) 417throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); 451throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); 516throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); 536throw new ArgumentException(SR.Format(SR.InvalidPictureType, "picture", nameof(Icon))); 788/// Saves this <see cref="Icon"/> to the specified output <see cref="Stream"/>. 820/// original data (outside of resizing if necessary). As such, the <see cref="Icon"/> only uses as much 824/// Without the original source data the <see cref="Icon(Icon, Size)">copy constructors</see> have to resample 825/// the current icon's bitmap to change sizes. For best image quality, if different sizes for an <see cref="Icon"/> 839/// An <see cref="Icon"/>, or <see langword="null"/> if an icon can't be found with the specified 851public static Icon? ExtractIcon(string filePath, int id, int size) 857/// If <see langword="true"/>, gets the <see cref="Icon"/> at the current system small icon size setting. If 858/// <see langword="false"/>, gets the <see cref="Icon"/> at the current system large icon size setting. Default is 862public static Icon? ExtractIcon(string filePath, int id, bool smallIcon = false) 865private static Icon? ExtractIcon(string filePath, int id, int size, bool smallIcon = false)
System\Drawing\IconConverter.cs (3)
36else if (value is Icon) 43if (value is Icon icon) 52if (value is Icon icon)
System\Drawing\ImageConverter.cs (2)
14return sourceType == typeof(byte[]) || sourceType == typeof(Icon); 24if (value is Icon icon)
System\Drawing\SystemIcons.cs (26)
11private static Icon? s_application; 12private static Icon? s_asterisk; 13private static Icon? s_error; 14private static Icon? s_exclamation; 15private static Icon? s_hand; 16private static Icon? s_information; 17private static Icon? s_question; 18private static Icon? s_warning; 19private static Icon? s_winlogo; 20private static Icon? s_shield; 22public static Icon Application => GetIcon(ref s_application, PInvokeCore.IDI_APPLICATION); 24public static Icon Asterisk => GetIcon(ref s_asterisk, PInvokeCore.IDI_ASTERISK); 26public static Icon Error => GetIcon(ref s_error, PInvokeCore.IDI_ERROR); 28public static Icon Exclamation => GetIcon(ref s_exclamation, PInvokeCore.IDI_EXCLAMATION); 30public static Icon Hand => GetIcon(ref s_hand, PInvokeCore.IDI_HAND); 32public static Icon Information => GetIcon(ref s_information, PInvokeCore.IDI_INFORMATION); 34public static Icon Question => GetIcon(ref s_question, PInvokeCore.IDI_QUESTION); 36public static Icon Warning => GetIcon(ref s_warning, PInvokeCore.IDI_WARNING); 38public static Icon WinLogo => GetIcon(ref s_winlogo, PInvokeCore.IDI_WINLOGO); 40public static Icon Shield => s_shield ??= new Icon(typeof(SystemIcons), "ShieldIcon.ico"); 42private static Icon GetIcon(ref Icon? icon, PCWSTR iconId) => 51/// <returns>The requested <see cref="Icon"/>.</returns> 55/// for the running version of Windows. Additionally, the returned <see cref="Icon"/> is not cached and 60public static unsafe Icon GetStockIcon(StockIconId stockIcon, StockIconOptions options = StockIconOptions.Default) 86public static unsafe Icon GetStockIcon(StockIconId stockIcon, int size)
System\Drawing\ToolboxBitmapAttribute.cs (2)
129using Icon ico = new(stream); 130using Icon sizedIco = new(ico, large ? s_largeSize : s_smallSize);
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)
3535=> 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; 533private static Icon DefaultIcon 542Icon defaultIcon = new(typeof(ErrorProvider), "Error"); 559public Icon Icon
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.cs (1)
452Icon 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)
103private static Icon? s_defaultIcon; 147private Icon? _icon; 148private Icon? _smallIcon; 858internal static Icon DefaultIcon 999public Icon? Icon 3411Icon? icon = Icon; 6436Icon? 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 (9)
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.EditorButton.cs (1)
125using Icon icon = new(typeof(DesignerActionPanel), "Arrow.ico");
System\Drawing\Design\CursorEditor.CursorUI.cs (5)
89using Icon wrapper = Icon.FromHandle(cursor.Handle); 90using Icon clone = (Icon)wrapper.Clone(); 91using Icon scaled = ScaleHelper.ScaleSmallIconToDpi(clone, dpi, alwaysCreateNew: true);
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)
2298using Icon err = SystemIcons.GetStockIcon(StockIconId.Error);
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, bool alwaysCreateNew = false)