From the SolidWorks API document, the icon for a user-defined custom taskpane view should be:
“The bitmap should be 16 colors and 16 x 18 (width x height) pixels. Any portions of the bitmap that are white (RGB 255,255,255) will be transparent.” The 16 colors bitmap is usually too ugly to accept. I therefore tried to use 32-bit BMP with transparencies, and also, I used 16×16 size bmp, which can be found here and there on the web. The good news is, it worked!
The bad news is that it worked locally, and when I packaged the project for deployment on the user’s machine, the icon I chose does not show up. I guess this might be due to the location of the bmp is not found. So I modified the code to make to be an abosolute path:
//This works only on local machine, when setup project is packaged, this no longer works
//pane = SwApp.CreateTaskpaneView2(“../VoiceCAD.bmp”, FormTitle);
//This works both on local machine and the deployed machine
string MainPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
DirectoryInfo MainDir = new DirectoryInfo(MainPath); // “file:///W|/bin”
string MainFolder = MainDir.Parent.FullName; //”\\”
string IconFilePath = Path.Combine(MainFolder, “VoiceCAD.bmp”);
pane = SwApp.CreateTaskpaneView2(IconFilePath, FormTitle);
Now, it works, really works.