segunda-feira, 21 de fevereiro de 2011

OnDraw (void);

Do you want to present images on your screen?

Lets see a simple code example:


void
FormMain::showImage(){
result r = E_SUCCESS;
// img
Image* pImg = null;
//path to your img
this->__imgPath = "/Res/Images/pista.png";

pImg = new Image();
r = pImg->Construct();
TryCatch(r == E_SUCCESS, , GetErrorMessage(r));
//Create a Bitmap == Osp::Graphics::Bitmap * __pBitmap1;
this->__pBitmap1 = pImg->DecodeN(this->__imgPath,
BITMAP_PIXEL_FORMAT_ARGB8888);
r = GetLastResult();
TryCatch(null != __pBitmap1 && r == E_SUCCESS,
,GetErrorMessage(r));

return;

CATCH:
SetLastResult(r);
AppLog("[%s] - Failed to initialize an instance of Image",
GetErrorMessage(r));

if (pImg != null) {
delete pImg;
pImg = null;
}
return;
}

If you need to present your image in other Form, you must overload OnDraw function.
OnDraw(void) is called when container needs to draw itself. Users can override this method to display user-specific drawings. This method is called after the container has drawn itself, but just before the container draws its child controls.


Thanks for your visit! :)

Next post: C.E.S.A.R Internship bada apps

Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo

Nenhum comentário:

Postar um comentário