You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dotnet-desktop-guide/net/winforms/controls-design/how-to-set-toolbox-icon.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,13 +30,13 @@ Icons for the **Toolbox** window in Visual Studio must conform to certain standa
30
30
Icons are assigned to a control with the <xref:System.Drawing.ToolboxBitmapAttribute> attribute. For more information about attributes, see [Attributes (C#)](/dotnet/csharp/programming-guide/concepts/attributes/index) or [Attributes overview (Visual Basic)](/dotnet/visual-basic/programming-guide/concepts/attributes/index).
31
31
32
32
> [!TIP]
33
-
> You can download a sample icon from [GitHub](https://github.com/dotnet/docs-desktop/blob/main/dotnet-desktop-guide/net/winforms/controls-design/media/how-to-set-toolbox-icon/CompassRose_Icon.bmp).
33
+
> You can download a sample icon from [GitHub](https://github.com/dotnet/docs-desktop/blob/main/dotnet-desktop-guide/net/winforms/controls-design/media/how-to-set-toolbox-icon/CompassRose.bmp).
34
34
35
35
The attribute is set on the control's class, and has three different constructors:
36
36
37
37
-<xref:System.Drawing.ToolboxBitmapAttribute.%23ctor(System.Type)>—This constructor takes a single type reference, and from that type, tries to find an embedded resource to use as the icon.
38
38
39
-
The type's <xref:System.Type.FullName>value is used to try to find a corresponding embedded resource based on the name of the type. For example, if the `MyProject.MyNamespace.CompassRose`type is referenced, the attribute looks for a resource named `MyProject.MyNamespace.CompassRose.bmp` or `MyProject.MyNamespace.CompassRose.ico`. If the resource is found, it's used as the control's icon.
39
+
The type's <xref:System.Type.FullName> is used to look up an [embedded resource][embedded] in the assembly of that type, using the following format: `{project-name}.{namespace-path}.{type-name}{.bmp|.ico}`. For example, if the type `MyProject.MyNamespace.CompassRose` is referenced, the attribute looks for an embedded resource named `MyProject.MyNamespace.CompassRose.bmp` or `MyProject.MyNamespace.CompassRose.ico`.
40
40
41
41
```csharp
42
42
// Looks for a CompassRose.bmp or CompassRose.ico embedded resource in the
@@ -57,22 +57,22 @@ The attribute is set on the control's class, and has three different constructor
57
57
EndClass
58
58
```
59
59
60
-
-<xref:System.Drawing.ToolboxBitmapAttribute.%23ctor(System.Type,System.String)>—This constructor takes two parameters. The first parameter is a type, and the second is the namespace and name of the resource in the assembly of that type.
60
+
-<xref:System.Drawing.ToolboxBitmapAttribute.%23ctor(System.Type,System.String)>—This constructor takes two parameters. The first parameter is a type, and the second is the namespace and name of the [embedded resource][embedded] in the assembly of that type.
61
61
62
62
```csharp
63
-
// Loads the icon from the WinFormsApp1.Resources.CompassRoseIcon.bmp resource
63
+
// Loads the icon from the WinFormsApp1.Resources.CompassRose.bmp resource
64
64
// in the assembly containing the type CompassRose
0 commit comments