Import multimedia files (.png, .mp3) into the project

Post your Gambas programming questions here.
Post Reply
User avatar
DavideTr
Posts: 4
Joined: Sunday 17th May 2020 8:20pm

Import multimedia files (.png, .mp3) into the project

Post by DavideTr »

Hi everyone, on Visual Studio from the project properties page I had the possibility to import different types of files which are then incorporated into the executable after compilation. I can recall these files from the script to load a ".png" image into a PictureBox or reproduce sounds etc.

My questions are as follows:
1). How can I do this same operation in Gambas 3, so that these files are incorporated into my compiled application?
2). How can I load a ".png" located inside my project into a PictureBox?

Thank you all :D
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Import multimedia files (.png, .mp3) into the project

Post by cogier »

How can I do this same operation in Gambas 3, so that these files are incorporated into my compiled application?
Place the files you want in the application's folder (From the menu Tools > Browse project..)
How can I load a ".png" located inside my project into a PictureBox?
You can add it in the IDE through the PictureBox property Picture or if the picture is in the application folder: -

PictureBox1.Picture = Picture["MyPict.png"]

See the 'no code used' example attached.
Picts-0.0.1.tar.gz
(705.58 KiB) Downloaded 297 times
User avatar
DavideTr
Posts: 4
Joined: Sunday 17th May 2020 8:20pm

Re: Import multimedia files (.png, .mp3) into the project

Post by DavideTr »

Thanks for the information, after inserting the various files into the project, by doing some tests I understood that to load an image I just need to use:

Code: Select all

 PictureBoxName.Picture = Picture.Load("Hours_CircleProgress/Hours_CircleProgress_" & 1 & ".png") 
Post Reply