void CRoom::draw() { POSITION pos; CButton* Button; CStatic* staticText; CString btnText[2]; CDevice* tmpDevice; int top = 10; int bottom = 30; int i = 0; int countButtonID = 3001; int countStaticID = 2001; CObList* list = phandleData->get_deviceList(); for (pos = list->GetHeadPosition(); pos != NULL;) { tmpDevice = (CDevice*)list->GetNext(pos); if(tmpDevice->get_room() != room) continue; if(tmpDevice->get_typ() == _T("fs20rsu")) { btnText[0] = _T("Auf"); btnText[1] = _T("Ab"); } else { btnText[0] = _T("An"); btnText[1] = _T("Aus"); } staticText = new CStatic(); DWORD dwStyleStatic = WS_EX_STATICEDGE; staticText->Create(tmpDevice->get_name(),dwStyleStatic,CRect(10,top,260,bottom),this,countStaticID); staticText->ShowWindow(TRUE); Button = new CButton(); DWORD dwStyle = WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON; Button->Create(btnText[0], dwStyle, CRect(300,top,340,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i] = countButtonID; countButtonID++; Button = new CButton(); Button->Create(btnText[1], dwStyle, CRect(360,top,400,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i+1] = countButtonID; countButtonID++; Button = new CButton(); Button->Create(_T("Details"), dwStyle, CRect(420,top,480,bottom), this, countButtonID); Button->ShowWindow(TRUE); Button = NULL; buttonIDs[i][i+2] = countButtonID; top += 30; bottom += 30; staticText = NULL; countButtonID++; countStaticID++; i++; } }