domingo, 17 de abril de 2011

switching images on button control (pressed and released)


...
//create two bitmaps (pressed image and released image)
__pBitmapExit = img.DecodeN(btnExitPath,
BITMAP_PIXEL_FORMAT_ARGB8888);
TryReturn(GetLastResult()==E_SUCCESS,GetLastResult(),
GetErrorMessage(GetLastResult()));
__pBitmapExitPressed = img.DecodeN(btnExitPressedPath,
BITMAP_PIXEL_FORMAT_ARGB8888);
TryReturn(GetLastResult()==E_SUCCESS,GetLastResult(),
GetErrorMessage(GetLastResult()));
...
//get button control
__pButtonExit = static_cast<Button *>(GetControl(L"IDC_BUTTON2"));
if (__pButtonExit != null)
{
//Sets a normal background bitmap to this Button.
__pButtonExit->SetNormalBackgroundBitmap(*__pBitmapExit);
//Sets a pressed background bitmap to this Button
__pButtonExit->SetPressedBackgroundBitmap(*__pBitmapExitPressed);
__pButtonExit->SetActionId(ID_BUTTON2);
__pButtonExit->AddActionEventListener(*this);

} else {
r = E_FAILURE;
}


Thanks for your visit! :)

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

label with background?

Need to put a bitmap in your label control?


//create an image
Image img;
r = img.Construct();
TryReturn(r==E_SUCCESS ,r, GetErrorMessage(r));

//create a bitmap (background)
__pBitmapBg = img.DecodeN(bgPopupPath,BITMAP_PIXEL_FORMAT_ARGB8888);
TryReturn(GetLastResult()==E_SUCCESS,GetLastResult(),
GetErrorMessage(GetLastResult()));

//get label control
__pLabelMainTitle = static_cast


Thanks for your visit! :)

Next post: switching images on button control (pressed and released)
Feel free to ask/suggest/comment.
Twitter: @oliveiraeduardo