Skip to content

HowTo: Add icon for custom node

Anna edited this page Jun 10, 2015 · 1 revision

Custom nodes, that are the part of package, support icons.

  1. Get ID of custom node. Open node with Notepad. Find its ID. It will something like ID="4cdf5500-fe21-402e-acb7-bb9fc1b5a64b"

  2. Open Visual Studio. Create in you solution resx file, named PackageImages.resx.

  3. Add to recently created file your image. Change your image name to .Small.png image

  4. Change icon persistence to Embedded in .resx

image

  1. Open .csproj file. Use Notepad.
  2. Uncomment BeforeBuild part.
  3. Write next code:

<Target Name="BeforeBuild">

<GetReferenceAssemblyPaths TargetFrameworkMoniker=".NETFramework, Version=v2.0">

<Output TaskParameter="FullFrameworkReferenceAssemblyPaths" PropertyName="FrameworkAssembliesPath" />

</GetReferenceAssemblyPaths>

<GenerateResource UseSourcePath="true" Sources="$(ProjectDir)PackageImages.resx"

OutputResources="$(ProjectDir)PackageImages.resources"

References="$(FrameworkAssembliesPath)System.Drawing.dll" />

<AL TargetType="library" EmbedResources="$(ProjectDir)PackageImages.resources"

OutputAssembly="$(OutDir)Package.customization.dll" />

</Target>

  1. Rebuild your project. Package.customization.dll will be in project's output folder.

  2. Add Package.customization.dll to your package.

image

NB! Default icon

You can add default icon, if you want to use 1 icon for all custom nodes. You have to make all steps, described above. But name of your icon should be DefaultCustomNode.Small

Clone this wiki locally