Drawing Background Image on wxDialog (wxMac 2.6.3)

Stefan Csomor csomor at advancedconcepts.ch
Thu Sep 28 22:27:05 PDT 2006


Hi

try having a wxPanel as the first and toplevel child of the dialog, and
paint the bitmap on the OnPaint event of this panel. This should work on
both platforms.

Best,

Stefan 

> -----Original Message-----
> From: Amit [mailto:amitgupta.it at gmail.com] 
> Sent: Freitag, 29. September 2006 07:57
> To: wx-users at lists.wxwidgets.org
> Subject: Drawing Background Image on wxDialog (wxMac 2.6.3)
> 
> 
> 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
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
> 
> 




More information about the wx-users mailing list