Skip to content

Commit 8019513

Browse files
authored
Fix icon file name in example (#1866)
* Fix name * Clarify toolbox instructions * Clarify toolbox instructions * Clarify toolbox instructions
1 parent 2e17961 commit 8019513

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

dotnet-desktop-guide/net/winforms/controls-design/how-to-set-toolbox-icon.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Icons for the **Toolbox** window in Visual Studio must conform to certain standa
3030
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).
3131

3232
> [!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).
3434
3535
The attribute is set on the control's class, and has three different constructors:
3636

3737
- <xref:System.Drawing.ToolboxBitmapAttribute.%23ctor(System.Type)>&mdash;This constructor takes a single type reference, and from that type, tries to find an embedded resource to use as the icon.
3838

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`.
4040

4141
```csharp
4242
// 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
5757
End Class
5858
```
5959

60-
- <xref:System.Drawing.ToolboxBitmapAttribute.%23ctor(System.Type,System.String)>&mdash;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)>&mdash;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.
6161

6262
```csharp
63-
// Loads the icon from the WinFormsApp1.Resources.CompassRoseIcon.bmp resource
63+
// Loads the icon from the WinFormsApp1.Resources.CompassRose.bmp resource
6464
// in the assembly containing the type CompassRose
65-
[ToolboxBitmap(typeof(CompassRose), "WinFormsApp1.Resources.CompassRoseIcon.bmp")]
65+
[ToolboxBitmap(typeof(CompassRose), "WinFormsApp1.Resources.CompassRose.bmp")]
6666
public partial class CompassRose : UserControl
6767
{
6868
// Code for the control
6969
}
7070
```
7171

7272
```vb
73-
' Loads the icon from the WinFormsApp1.Resources.CompasRoseIcon.bmp resource
73+
' Loads the icon from the WinFormsApp1.Resources.CompassRose.bmp resource
7474
' in the assembly containing the type CompassRose
75-
<ToolboxBitmap(GetType(CompassRose), "WinFormsApp1.Resources.CompasRoseIcon.bmp")>
75+
<ToolboxBitmap(GetType(CompassRose), "WinFormsApp1.Resources.CompassRose.bmp")>
7676
Public Class CompassRose
7777
' Code for the control
7878
End Class
@@ -96,3 +96,5 @@ The attribute is set on the control's class, and has three different constructor
9696
' Code for the control
9797
End Class
9898
```
99+
100+
[embedded]: /visualstudio/ide/build-actions
File renamed without changes.

0 commit comments

Comments
 (0)