|
发表于 2017-5-22 13:31:00
|
显示全部楼层
如果你还是用的你发的模板,那就是错的因为你的三列全都是图片元素,
如果你更换了正确的模板,而且第一列元素是ShapeText,那就看一下项模板是不是真的加载成功了....
项目模板:
- <?xml version="1.0" encoding="gb2312" ?>
- <!--炫彩界面库-列表元素项模板文件-->
- <xc_template_list showT="true">
- <listHeader_item showT="true">
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="2,2,15,2" layout.space="5" layout.width="fill" showT="true" widthT="300">
- <layoutObject layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="0,2,0,0" layout.width="14" showT="true" />
- <shapeText content="歌曲名" layout.height="20" layout.width="auto" left="41" showT="true" top="25" width="20" />
- </layoutObject>
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="2,2,2,2" layout.space="2" layout.width="fill" showT="true" widthT="300">
- <shapeText content="专辑" itemID="0" layout.height="fill" layout.width="auto" showT="true" />
- </layoutObject>
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="2,2,2,2" layout.space="2" layout.width="fill" showT="true" widthT="300">
- <shapeText content="时长" itemID="0" layout.height="fill" layout.width="auto" showT="true" />
- </layoutObject>
- </listHeader_item>
-
- <list_Item showT="true">
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="15,2,2,2" layout.space="5" layout.width="fill" showT="true" widthT="300">
- <shapePicture height="100" image="{binding field=name source=data bSync=false}" layout.height="fill" layout.width="52" left="58" showT="true" top="38" width="100" />
- </layoutObject>
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="2,2,2,2" layout.space="2" layout.width="fill" showT="true" widthT="300">
- <textLinkUI content="{binding field=name2}" drawBorder="false" drawFocus="false" height="20" itemID="105" layout.width="auto" left="177" showT="true" top="252" transparent="true" underlineLeave="true" underlineStay="true" width="100" />
- </layoutObject>
- <layoutObject heightT="30" layout.alignH="left" layout.alignV="center" layout.height="fill" layout.horizon="true" layout.padding="2,2,2,2" layout.space="2" layout.width="fill" showT="true" widthT="300">
- <shapeText content="{binding field=name3}" layout.height="20" layout.width="auto" left="152" showT="true" top="324" />
- </layoutObject>
-
- </list_Item>
- </xc_template_list>
复制代码
代码:
- m_hList = XList_Create(0,30,500,470,myForm.m_hWindow);
- if(m_hList == 0)
- {
- ::MessageBoxA(0,"","",0);
- }
- XEle_AddBkFill(m_hList,255,200);
- XList_SetItemTemplateXML(m_hList,L"F:\\工程源码\\VC++\\TestDui\\Debug\\sgTreeListItemSelect.xml");
- XList_SetItemHeightDefault(m_hList,30,50);
- XList_AddColumn(m_hList,100);
- XList_AddColumn(m_hList,100);
- XList_AddColumn(m_hList,100);
-
- HXCGUI hAdapterHeader=XAdMap_Create();
- XList_BindAdapterHeader(m_hList,hAdapterHeader);
- XAdMap_AddItemText(hAdapterHeader,(XC_NAME),L"aaa");
- XAdMap_AddItemText(hAdapterHeader,(XC_NAME2),L"bbb");
- XAdMap_AddItemText(hAdapterHeader,(XC_NAME3),L"ccc");
-
- HXCGUI hAdapter=XAdTable_Create();
- XList_BindAdapter(m_hList,hAdapter);
- XAdTable_AddColumn(hAdapter,(XC_NAME));
- XAdTable_AddColumn(hAdapter,(XC_NAME2));
- XAdTable_AddColumn(hAdapter,(XC_NAME3));
- XList_SetColumnWidth(m_hList,0,150);
- XList_SetColumnWidth(m_hList,1,150);
- XList_SetColumnWidth(m_hList,2,150);
- wchar_t tmp[MAX_PATH]={0};
- HIMAGE hImage = XImage_LoadFile(L"C:\\Users\\COST\\Desktop\\QQ截图20170522171656.png",TRUE);
- int nId = 0;
- for (int i=0;i<20;i++)
- {
- wsprintf(tmp,L"item-%d",i);
- if(hImage == 0)
- {
- ::MessageBoxA(0,"","",0);
- }
- //XAdTable_AddItemImage(hAdapter,hImage);
- nId = XAdTable_AddItemImage(hAdapter,hImage);
- wsprintf(tmp,L"child-%d-1",i); XAdTable_SetItemText(hAdapter,i,1,tmp);
- wsprintf(tmp,L"child-%d-2",i); XAdTable_SetItemText(hAdapter,i,2,tmp);
- }
复制代码
|
|