给 Listbox 的 item 添加背景(未验证)

void CProfileListBox::ConstructL(const TRect& aRect,
  const CCoeControl* aParent, MEikCommandObserver* aCommandObserver)
  {
  ...
  TFileName iMFileName;
  iMFileName.Copy(KMifFileName);
  CompleteWithAppPath(iMFileName);

  setBackground();

  iBgContext = CAknsBasicBackgroundControlContext::NewL(aSkinItem, aRect,
  ETrue);


  ActivateL();
  ...

  }

void CProfileListBox::setBackground()
  {
  TFileName iMFileName;
  iMFileName.Copy(KMifFileName);
  CompleteWithAppPath(iMFileName);
  aSkinItem.iMinor = 0xE2139689;
  aSkinItem.iMajor = 1;
  CAknsItemDef* mainBgItemDef = AknsUtils::CreateBitmapItemDefL(
  aSkinItem, iMFileName,
  EMbmContextcallhandLandscape_profile);
  AknsUtils::SkinInstance()->SetLocalItemDefL(mainBgItemDef);
  }
posted @ 2011-09-14 11:44  zziss  阅读(175)  评论(0编辑  收藏  举报