Archive: BMP image as button in nsDialogs?


BMP image as button in nsDialogs?
  In nsDialogs, is there a way to map a BMP image onto a button? I was to use a button, but I'd rather have an image on it rather than just plain text. Thanks.


This probably isn't possible without writing some plug-in in C/C++ to create a custom-drawn button.

Stu


Actually, the BS_BITMAP icon should do the trick. Create a button with this style and then use the appropriate Windows message to set the image. BM_SETIMAGE sounds like it'd do the trick.


Nice, and according to MSDN if you use BM_SETIMAGE without the BS_BITMAP or BS_ICON styles set, the text will also be displayed along with the image.

Stu


Indeed:


"${BS_BITMAP}"


>; Set the bitmap.
>System::Call 'user32::LoadImage(i 0, t "$PLUGINSDIR\test.bmp", i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_CREATEDIBSECTION}|${LR_LOADFROMFILE}) i.s'
>Pop $6

SendMessage $BUTTON${BM_SETIMAGE} ${IMAGE_BITMAP} $6
>
Works fine, a bitmap button without text.

But if ${NSD_AddStyle} $BUTTON "${BS_BITMAP}" is omitted the text comes back without the bitmap inside the button :(