I am using the following code to set background image to a panel. But nothing is getting set as background. Am i doing things correctly? How to set background image for a panel, form or a container?
Panel* pBgPanel = new Panel;
pBgPanel->Construct(*pLayout, Rectangle(10, 10, 320, 320));
AddControl(*pBgPanel);
Image bgImage;
bgImage.Construct();
Osp::Graphics::Bitmap * bgBitmap;
bgBitmap = bgImage.DecodeN(L"/Home/bg.png", BITMAP_PIXEL_FORMAT_ARGB8888);
Canvas* pCanvas = pBgPanel->GetCanvasN();
pCanvas->DrawBitmap(*(new Point(0,0)),*bgBitmap);
pCanvas->Show();
you must make yourown panel ( class MyPanel : public Panel {}
) and then override function virtual void OnDraw (void)
and there you can draw the bitmap to canvas
don't forget call the base of OnDraw Panel::OnDraw();
for drawing component which you have on panel;-)