先看效果图:
xml代码:
作者qq:80101277,dskinlite交流qq群:138231653 <window name="listbox1" type="listbox"> <property bkcolor="#system_bg" bordercolor="RGB(0,255,0)" scrollbar="scrollbar" headerctrl="headerctrl" /> <rect id="border" index="1" bordercolor="#system.border" borderwidth="1" style="hole" /> <rect id="border" index="2" bordercolor="RGB(255,255,255)" left="1" top="1" right="-1" bottom="-1" borderwidth="1" style="hole" /> <rect id="item" bordercolor="RGB(221,234,242)" fillcolor="RGB(232,247,254)" left="1" bottom ="-1" state="over"/> <image id="item" picfile="#listbox.select" left="3" right="-15" paintmode="stretchparthorz" left_part="3" right_part="3" state="checked"/> <rect id="listitem.odd" bordercolor="RGB(255,255,255)" fillcolor="RGB(251,251,255)" state="all"/> <rect id="listitem.even" bordercolor="RGB(255,255,255)" fillcolor="RGB(243,248,251)" state="all"/> <listboxinfo bDrawOver="true" itemheight="35" > <drawitem id="default" > <image state="all" id="image.default" picfile="#face.default" left="5" top="2" width="20" height="20"/> <text id="text.default" content="" left="30" top="4" state="normal" textcolor="RGB(0,0,0)" font="#default"/> <text id="text.default" content="" left="30" top="4" state="over" textcolor="RGB(255,0,0)" font="#default"/> <text id="text.default" content="" left="30" top="4" state="checked" textcolor="RGB(255,0,0)" font="#default"/> <eventitem id="close" event="LButtonDown" cursor="handcur" state="over|checked" left="-20" top="5" width="15" height="15" visible="true"> <image state="normal" picfile="#extend.listbox.closebtn.nor" /> <image state="over" picfile="#extend.listbox.closebtn.over" /> </eventitem> </drawitem> </listboxinfo> </window>
BOOL CXXDlg::OnInitDialog() 加入如下代码: dsSkinWindow(GetSafeHwnd(), SKIN_TYPE_DIALOG, NULL, TRUE); dsSkinWindow(m_listbox1.GetSafeHwnd(), SKIN_TYPE_LISTBOX, L"listbox1", FALSE); m_listbox1.SetItemHeight(0, 30); for (int i = 0; i < 32; i++) { CString title; title.Format(L"%x---%x---%x", i, i, i); m_listbox1.InsertString(i, _T("")); m_listbox2.InsertString(i, title); CString img = GetFaceImageByIndex(i % 16); dsSetDrawItemValueEx(m_listbox1.GetSafeHwnd(), i, 0, _T("image.default"), img, FALSE); dsSetDrawItemValueEx(m_listbox1.GetSafeHwnd(), i, 0, _T("text.default"), title, FALSE); }
时间: 2024-10-09 22:18:56