There are a lot of ways it won't work, I've found only one reliable way, documented by this webpage. The step-by-step instructions: create a new class library project, name it ClassLibrary1. Add a bitmap resource and name it "MyButton.bmp". Click the bitmap in the Solution Explorer and change the Build Action to "Embedded Resource".
Write your control class code like this:
using System;
using System.Drawing;
using System.Windows.Forms;
internal class resfinder { }
namespace MyControls
{
[ToolboxBitmap(typeof(resfinder), "ClassLibrary1.MyButton.bmp")]
public class MyButton : Button
{
}
}
The "resfinder" class is a trick to let the GetImageFromResource() method find the bitmap resource in the proper namespace. This is necessary because I made the namespace for the control ("MyControls") different from the default namespace of the class library ("ClassLibrary1"). The resfinder type reference forces .NET to look for the bitmap resource in "ClassLibrary1.MyButton.bmp" rather than "MyControls.ClassLibrary1.MyButton.bmp".
Build the project. Open the project that will use your control. Right-click the tool box and select "Choose items...". Click on Browse and select the ClassLibrary1.dll assembly. You should now see the MyButton control with the proper bitmap.