Tizen Developers

Menu
Sites
Language
Background wallpaper

Hello,

I would like to put a wallpaper on my form. I use canvas and bitmap class to do that but when I test it, nothing happens. Do you know why?

​​​result
MainForm::OnInitializing(void)
{
result r = E_SUCCESS;

Image img;
Bitmap* pBitmap = null;
Canvas* pCanvas = null;
String filePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.png";

img.Construct();

pBitmap = img.DecodeN(filePath, BITMAP_PIXEL_FORMAT_ARGB8888);
if (pBitmap != null)
{
AppLog("OK_Bitmap");
}

pCanvas = GetCanvasN();
if (pCanvas != null)
{
AppLog("OK_Canvas");
}

pCanvas->DrawBitmap(Point(0,0), *pBitmap);
pCanvas->Show();

SetFormBackEventListener(this);

// Get a button via resource ID
Tizen::Ui::Controls::Button *pButtonOk = static_cast<Button*>(GetControl(IDC_BUTTON_OK));
if (pButtonOk != null)
{
pButtonOk->SetActionId(ID_BUTTON_OK);
pButtonOk->AddActionEventListener(*this);
}

return r;
}
Edited on 18 03, 2014

Responses

5 Replies
Pushpa G
Declare virtual result OnDraw(); method in .h file and in its corresponding .cpp file add the following code : result TestBackgroundForm::OnDraw() { result r; Canvas* canvas=this->GetCanvasN(); r= canvas->DrawBitmap(Rectangle(0, 66,480,800-138), * pBitmap); if (IsFailed(r)) { AppLog("Draw Bitmap Failed"); return r; } return r; } It will draw the bitmap as background. No issues, i have tested it:)
Benoit JOUANIGO
Thank you for your help. Now I have a bitmap as background :D
Pushpa G
Its ok:) I thank you too for updating me on this:)
Levan Gogohia

Sorry, where are you declared pBitmap? 

Levan Gogohia

Please tell me I'm doing background to the application and permission from the screen 720 * 1086, I did a background but he got beyond the screen, tell me what size the background to do?