0
對不起,對此(可能非常愚蠢)的問題,但我很困惑:我嘗試使用SetScaleMode()
as described in the documentation在wxWidgets v3.0.2中縮放位圖。我用include語句,儘管我的編譯器(GCC跟在C++ 11之後)說'class wxStaticBitmap' has no member named 'SetScaleMode'|
和'Scale_AspectFit' was not declared in this scope|
。 也許我忽略了一些東西,下面是我的(縮短)代碼:wxStaticBitmap沒有名爲「SetScaleMode()」的成員
#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);
}
(我希望我沒有刪除一些重要的東西在這個片段中,我想讓它更易於閱讀)
呃,我完全忽略了這個。感謝那。 – Lehue