Anmelden

Archiv verlassen und diese Seite im Standarddesign anzeigen : wxBitmap auf Frame bzw. in wxBoxSizer anzeigen



Morfio
09-05-2005, 19:46
Hallo,

ich entwickle gerade an einer OpenSource-Software mit wxWidgets. Nun möchte ich auf einem Frame aber ein Bild anzeigen, was ich irgendwie nicht hinbekomme. Er zeigt einfach das Bild nicht an. Ich benutze dazu wxBitmap:



#include "login.h"
//#include "../div/bitmaps/login.xpm"
#include "../div/bitmaps/btnactive.xpm"

dsLogin::dsLogin(wxWindow *parent,
wxWindowID id,
const wxString &title,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name) : wxFrame(parent, id, title, pos, size) {

// wxBoxSizer *wbsMain = new wxBoxSizer(wxVERTICAL);

// wxButton *button = new wxButton(this, -1, "gna");
wxBitmap *bitmap = new wxBitmap(btnactive_xpm);

}


Wie bekomme ich ein Bild angezeigt?

Vielen Dank,

Morfio ...

oracle2025
10-05-2005, 06:57
Verwende wxStaticBitmap

Morfio
10-05-2005, 17:28
Hi,

habe ich schon. Kommt genauso wenig ein Bild. Ich habe gelesen, dass man per Hand den Frame neuzeichnen muss ... ist das wirklich so? Irgendwie will das noch nicht so ganz.

Morfio ...

Morfio
10-05-2005, 17:45
Hier ist die Lösung im Quelltext, hoffe, es hilft auch andern, da ich diesbezüglich nirgends im Internet was gefunden hatte:



#include "../div/bitmaps/login.xpm"
//#include "../div/bitmaps/btnactive.xpm"

BEGIN_EVENT_TABLE(dsLogin, wxFrame)
EVT_PAINT(dsLogin::OnPaint)
END_EVENT_TABLE()

dsLogin::dsLogin(wxWindow *parent,
wxWindowID id,
const wxString &title,
const wxPoint &pos,
const wxSize &size,
long style,
const wxString &name) : wxFrame(parent, id, title, pos, size) {

//// wxBoxSizer *wbsMain = new wxBoxSizer(wxVERTICAL);

// wxButton *button = new wxButton(this, -1, "gna");


bitmap = new wxBitmap(login_xpm);
}

void dsLogin::OnPaint(wxCommandEvent &event) {
wxPaintDC *dc = new wxPaintDC(this);
dc->BeginDrawing();
dc->DrawBitmap(*bitmap, 1, 1, false);
dc->EndDrawing();
}