Author |
Topic: Transparent images in a dialogue box (Read 400 times) |
|
JB91
New Member
member is offline


Gender: 
Posts: 2
|
 |
Transparent images in a dialogue box
« Thread started on: Mar 12th, 2017, 4:03pm » |
|
Hello,
The main help documentation describes how to display a bitmap image in a dialogue box, however, it cannot seem to display images with a transparent background properly.
How could you adapt the code to display a transparent image?
Thanks, Josh
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 803
|
 |
Re: Transparent images in a dialogue box
« Reply #1 on: Mar 12th, 2017, 5:42pm » |
|
on Mar 12th, 2017, 4:03pm, JB91 wrote:| The main help documentation describes how to display a bitmap image in a dialogue box, however, it cannot seem to display images with a transparent background properly. |
|
To do that you need to replace the .BMP image (which is opaque) with a .ICO image (which can have transparent regions). You also need to change the SS_BITMAP stylebit to SS_ICON, and change the first parameter of the STM_SETIMAGE message from IMAGE_BITMAP to IMAGE_ICON:
Code:LR_LOADFROMFILE = 16STM_SETIMAGE = 370IMAGE_ICON = 1SYS "LoadImage", 0, icofile$, IMAGE_ICON, cx%, cy%, LR_LOADFROMFILE TO hicon%SYS "SendDlgItemMessage", !dlg%, id%, STM_SETIMAGE, IMAGE_ICON, hicon% This is very similar to the process for Displaying an icon on a pushbutton documented at the Wiki here.
Richard.
|
|
Logged
|
|
|
|
JB91
New Member
member is offline


Gender: 
Posts: 2
|
 |
Re: Transparent images in a dialogue box
« Reply #2 on: Mar 13th, 2017, 11:54am » |
|
Thank you, Richard. I converted the .bmp images to .ico and it works great!
Thanks, Josh.
|
|
Logged
|
|
|
|
|