For example, the following code
Bm. LoadFile (filename, wxbitmap_type_bmp);
A run-time error occurred.
The reasons may be as follows:
FileName is not a BMP type.
Method:
Change wxbitmap_type_bmp to Team type or Wxbitmap_type_any
Also load the corresponding driver before the LoadFile "before", such as:
Wximage::addhandler (new Wxjpeghandler); Wximage::addhandler (new Wxpnghandler); Wximage::addhandler (new Wxgifhandler);
Attention, it's wximage!.
2. Path is not correct
LoadFile default to find files from the current path. When there is only one item, there is usually no error.
However, if there is a project with multiple projects, the current path may be elsewhere, then you can
Get the current path in the following way
Wxstring getworkdirectory () {wxstring strapppath; wxstandardpathsbase& STDP = Wxstandardpaths::get (); WxFileName ex Efile (STDP. Getexecutablepath ()); Strapppath = Exefile.getpath (Wxpath_get_volume | wxpath_get_separator); return Strapppath;}
If the current path is not desired, then congratulate you and find the error.
Wxbitmap LoadFile failed please check. rc file how to solve