Sorry for this (possibly very dumb) question, but I am quite confused: I try to scale a bitmap in wxWidgets v3.0.2 using SetScaleMode()
as described in the documentation. I used the include statement, though my compiler (GCC following C++11) says that 'class wxStaticBitmap' has no member named 'SetScaleMode'|
and 'Scale_AspectFit' was not declared in this scope|
.
Maybe I overlooked something, below is my (shortened) code:
#include <wx/msgdlg.h>
#include <wx/thread.h>
#include <wx/event.h>
#include <wx/statbmp.h>
//(*InternalHeaders(WindowsDgpsGUIFrame)
#include <wx/bitmap.h>
#include <wx/icon.h>
#include <wx/intl.h>
#include <wx/image.h>
#include <wx/string.h>
//*)
//wxTextFile file;
//helper functions
enum wxbuildinfoformat {
short_f, long_f };
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(WindowsDgpsGUIFrame)
const long WindowsDgpsGUIFrame::ID_STATICBITMAP1 = wxNewId();
const long WindowsDgpsGUIFrame::ID_PANEL1 = wxNewId();
BEGIN_EVENT_TABLE(WindowsDgpsGUIFrame,wxFrame)
//(*EventTable(WindowsDgpsGUIFrame)
//*)
END_EVENT_TABLE()
WindowsDgpsGUIFrame::WindowsDgpsGUIFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(WindowsDgpsGUIFrame)
wxBoxSizer* pBitmapBoxSizer;
wxBoxSizer* pPanelBoxSizer;
Create(parent, wxID_ANY, _("SensoRun"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE|wxMAXIMIZE_BOX, _T("wxID_ANY"));
SetForegroundColour(wxColour(187,0,0));
SetBackgroundColour(wxColour(128,128,128));
{
wxIcon FrameIcon;
FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T(".\\resources\\sd.ico"))));
SetIcon(FrameIcon);
}
pPanel = new wxPanel(this, ID_PANEL1, wxPoint(280,352), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
pPanelBoxSizer = new wxBoxSizer(wxVERTICAL);
pBitmapBoxSizer = new wxBoxSizer(wxVERTICAL);
StaticDirectionBitmap = new wxStaticBitmap(pPanel, ID_STATICBITMAP1, wxBitmap(wxImage(_T(".\\resources\\kein_pfeil.png"))), wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER, _T("ID_STATICBITMAP1"));
pBitmapBoxSizer->Add(StaticDirectionBitmap, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
pPanelBoxSizer->Add(pBitmapBoxSizer, 1, wxALL|wxEXPAND|wxFIXED_MINSIZE|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticDirectionBitmap->SetScaleMode(Scale_AspectFit);
}
(I hope I did not delete something important in this snippet, I wanted to make it easier to read)
As you can surely see in the doc you link to, wxStaticBitmap::SetScaleMode()
is there Since 3.1.0
, while you are using "wxWidgets v3.0.2". So just upgrade to the correct version.