×
Namespaces

Variants
Actions

使用CAknIconArray读取资源图标供listbox使用

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata

文章
User:Jiangbaolan 在 02 Apr 2009 创建
最后由 hamishwillee 在 15 Dec 2011 编辑

symbian API中提供了使用CAknIconArray读取资源图标供listbox所用的方法。 它使用了AKN_ICON_ARRAY结构,请问能否提供一段代码描述如何使用? 解答: 在资源中有如下描述:

Code: RESOURCE AKN_ICON_ARRAY r_icon_testIcons

   {
   type = EAknIconArraySimple;
   bmpfile = "z:\SYSTEM\DATA\AVKON.MBM";
   icons =
       {
       AKN_ICON
           {
           iconId = EMbmAvkonQgn_indi_checkbox_on;
           maskId = EMbmAvkonQgn_indi_checkbox_on_mask;
           },
       AKN_ICON
           {
           IconId = EMbmAvkonQgn_indi_checkbox_off;
           maskId = EMbmAvkonQgn_indi_checkbox_off_mask;
           }
       };
   }这里资源包括了checkboxes的缺省图标。

在编写代码时,可以使用CAknIconArray::ConstructFromResourceL()来构造图标

Code: ... // CAknSingleGraphicStyleListBox* iListbox; iListbox = new(ELeave)CAknSingleGraphicStyleListBox(); iListbox->SetContainerWindowL(*this); TResourceReader reader; CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LIST); iListbox->ConstructFromResourceL(reader); // Creates a GUI icon array. CAknIconArray* icons =new(ELeave) CAknIconArray(2); CleanupStack::PushL(icons); icons->ConstructFromResourceL(R_ICON_TESTICONS); // Sets graphics as ListBox icon. iListbox->ItemDrawer()->ColumnData()->SetIconArray(icons); CleanupStack::Pop(); // icons CleanupStack::PopAndDestroy(); // reader

This page was last modified on 15 December 2011, at 09:35.
70 page views in the last 30 days.
×