Drawing Background Image on wxDialog (wxMac 2.6.3)

Amit amitgupta.it at gmail.com
Thu Sep 28 22:56:31 PDT 2006


Hello,

I am trying to get an image as background on wxDialog. For this I am
using the following code.
The code works well on Windows but Image is not drawn on Mac. I am
using wxMac 2.6.3 and XCode 2.3.

void LoginDlg::EraseBackground(wxEraseEvent& refEvent)
{
	wxBitmap Bitmap;
#ifdef __WXMAC__
	Bitmap.LoadFile(wxGetCwd() +
			wxT("/myApp.app/Contents/Resources/Images/log_in.jpg"),
			wxBITMAP_TYPE_JPEG);
#else
	Bitmap.LoadFile(wxT("../Images/logg_in.jpg"), wxBITMAP_TYPE_JPEG);
#endif

	wxDC* ptrDC = refEvent.GetDC();

	wxMemoryDC dcMem;
	dcMem.SelectObject(Bitmap);
        ptrDC->Blit(0, 0, Bitmap.GetWidth(), Bitmap.GetHeight(), &
dcMem, 0, 0);
        dcMem.SelectObject(wxNullBitmap);
}

EVT_ERASE_BACKGROUND(LoginDlg::EraseBackground)

Any help on this will be higly appreciated.

In Regards
-Amit







More information about the wx-users mailing list