BBC BASIC
« Transparent images in a dialogue box »

Welcome Guest. Please Login or Register.
Jan 23rd, 2018, 7:09pm


Cross-platform BBC BASIC (Win32, Linux x86, Android, Mac OS-X, Raspberry Pi)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Transparent images in a dialogue box  (Read 287 times)
JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 2
xx 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
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 692
xx 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 = 16
STM_SETIMAGE = 370
IMAGE_ICON = 1
SYS "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.
User IP Logged

JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 2
xx 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.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Donate $6.99 for 50,000 Ad-Free Pageviews!


This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls