User forums > Using Code::Blocks

How to add image file to Builds, or setting image path for deployment exe.

(1/1)

Aaron:
I'm learning CB 13.12 (with wxWidgets 3.0.2 and MinGW on windows) and trying to find out how to add a small logo image for example to a project.
The CB manual doesn't answer this that I could find.  No old posts found.

As is, the app is looking in the path of image file in Code Blocks project folder. So when the app is run on a foreign PC there is an error when the image files are not found.

What is a recommended method.  The Bitmap file properties will not allow user to over write browsed file location.

any ideas welcomed. 

Aaron:
I figured it out.

I edited the StaticBitmap1 line in my Main.cpp to the image file path of the deployed exe file, removing the long path. ( now same dir as EXE)


--- Code: ---StaticBitmap1 = new wxStaticBitmap(Panel1, ID_STATICBITMAP1, wxBitmap(wxImage(_T("Logo1.bmp"))), wxPoint(16,360), wxDefaultSize, wxSIMPLE_BORDER, _T("ID_STATICBITMAP1"));
--- End code ---

There is probably a more correct solution using CB IDE features.

Navigation

[0] Message Index

Go to full version