int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { XInitXCGUI(); //创建窗口 hWindow=XWnd_CreateWindow(0,0,400,300,L"炫彩界面库-窗口"); hImage1=XImage_LoadFile(L"image\\button_leave.png"); hImage2=XImage_LoadFile(L"image\\button_stay.png"); hImage3=XImage_LoadFile(L"image\\button_down.png"); hImage1_check=XImage_LoadFile(L"image\\button_check_leave.png"); hImage2_check=XImage_LoadFile(L"image\\button_check_stay.png"); hImage3_check=XImage_LoadFile(L"image\\button_check_down.png"); HELE hRadio1=CreateRadio(10,10,L"Radio1"); HELE hRadio2=CreateRadio(10,50,L"Radio2"); HELE hRadio3=CreateRadio(10,90,L"Radio3"); HELE hRadio4=CreateRadio(10,130,L"Radio4"); HELE hRadio5=CreateRadio(10,170,L"Radio5"); XBtn_SetCheck(hRadio1,TRUE); /////////////////////////////////////////////////////// HELE hEle1=XEle_Create(130,10,200,35,hWindow); HELE hEle2=XEle_Create(130,50,200,35,hWindow); HELE hEle3=XEle_Create(130,90,200,35,hWindow); HELE hEle4=XEle_Create(130,130,200,35,hWindow); HELE hEle5=XEle_Create(130,170,200,35,hWindow); XRadio_SetBindEle(hRadio1,hEle1); XRadio_SetBindEle(hRadio2,hEle2); XRadio_SetBindEle(hRadio3,hEle3); XRadio_SetBindEle(hRadio4,hEle4); XRadio_SetBindEle(hRadio5,hEle5); XEle_SetBkColor(hEle1,RGB(249,141,235)); XEle_SetBkColor(hEle2,RGB(105,20,193)); XEle_SetBkColor(hEle3,RGB(0,179,138)); XEle_SetBkColor(hEle4,RGB(213,48,68)); XEle_SetBkColor(hEle5,RGB(42,110,187)); XEle_ShowEle(hEle2,FALSE); XEle_ShowEle(hEle3,FALSE); XEle_ShowEle(hEle4,FALSE); XEle_ShowEle(hEle5,FALSE); XWnd_ShowWindow(hWindow,SW_SHOW); XRunXCGUI(); return 0; }
int OnListBoxTemplateCreateEnd(listBox_item_i* pItem,BOOL *pbHandled) { //获取模板中(itemID=1)按钮 HELE hButton=(HELE)XListBox_GetTemplateObject(m_hListBox,pItem->index,1); if(XC_IsHXCGUI(hButton,XC_BUTTON)) { XBtn_SetCheck(hButton,XListBox_GetItemData(m_hListBox,pItem->index)); XBtn_SetText(hButton,L"初始化"); //注册按钮点击事件 XEle_RegEventCPP1(hButton,XE_BUTTON_CHECK,&CMyWindowListBox::OnButtonCheck); } *pbHandled=TRUE; return 0; }
int OnListTemplateCreateEnd(list_item_i* pItem,BOOL *pbHandled) { if (pItem->iSubItem == 0) //按钮在第0列 { HXCGUI hBtn = XList_GetTemplateObject(m_hList,pItem->index,1); if (XC_GetObjectType(hBtn) == XC_BUTTON) { //记住选中状态 BOOL isCheck = XList_GetItemData(m_hList,pItem->index,pItem->iSubItem); XBtn_SetCheck((HELE)hBtn,isCheck); XEle_RegEventCPP1((HELE)hBtn,XE_BUTTON_CHECK,&CRightPane::OnButtonCheck); } } *pbHandled = TRUE; return 0; }
void SetSelect(int nIndex) { HELE hBtn = GetLabelBtn(nIndex); XBtn_SetCheck(hBtn,TRUE); XEle_RedrawEle(m_hEle); }