Raul
Raul

Reputation: 33

Load images from file (any pc works) C++ Builder

I want to load some images from a folder but I want to works on another pc.

I load an image like this:

Image1->Picture->Bitmap->LoadFromFile("C:\\Users\\Raul\\Desktop\\Cards BMP\\2_of_diamonds.bmp" );

And when I run project on another pc that "C:\Users\Raul\Desktop\" is diffrent.

How can I load that image from another pc?

I use C++ Builder 6.

Upvotes: 1

Views: 7105

Answers (2)

kizeloo
kizeloo

Reputation: 183

If you need to load a JPEG (*.jpg), you can use:

Image1->Picture->LoadFromFile("Images/2_of_diamonds.jpg" );

Upvotes: 1

Tarik Neaj
Tarik Neaj

Reputation: 548

You can create a folder called Images where your project is, where are the files are created etc. Then you just have to do

Image1->Picture->Bitmap->LoadFromFile("Images/2_of_diamonds.bmp" );

And it can be done from any pc because the image is in the project folder.

Upvotes: 1

Related Questions