Adding an Image to the Image List
Go Up to Using Native IDE Objects
Suppose you want to add a menu item to invoke your wizard. You also want to enable the user to add a toolbar button that invokes the wizard. The first step is to add an image to the IDE image list. The index of your image can then be used for the action, which in turn is used by the menu item and toolbar button. Create a resource file that contains a 16 by 16 bitmap resource. Add the following code to your wizard constructor:
Delphi:
constructor MyWizard.Create;
var
Services: INTAServices;
Bmp: TBitmap;
ImageIndex: Integer;
begin
inherited;
Supports(BorlandIDEServices, INTAServices, Services);
{ Add an image to the image list. }
Bmp := TBitmap.Create;
Bmp.LoadFromResourceName(HInstance, 'Bitmap1');
ImageIndex := Services.AddMasked(Bmp, Bmp.TransparentColor,
'Tempest Software.intro wizard image');
Bmp.Free;
end;
C++:
_di_INTAServices services;
BorlandIDEServices->Supports(services);
// Add an image to the image list.
Graphics::TBitmap* bitmap(new Graphics::TBitmap());
bitmap->LoadFromResourceName(reinterpret_cast<unsigned>(HInstance), "Bitmap1");
int image = services->AddMasked(bitmap, bitmap->TransparentColor,
"Tempest Software.intro wizard image");
delete bitmap;
Be sure to load the resource by the name or ID you specify in the resource file. You must choose a color that will be interpreted as the background color for the image. If you don't want a background color, choose a color that does not exist in the bitmap.