void CColorPicker::InitWindow() { CVerticalLayoutUI* pColorContiner = static_cast<CVerticalLayoutUI*>(GetPaintMgr()->FindControl(_T("color"))); for (int i = 0; (i < 5) && (pColorContiner != NULL); i ++) { CHorizontalLayoutUI* pLine = new CHorizontalLayoutUI(); pLine->SetFixedHeight(12); pColorContiner->Add(pLine); for (int j = 0; j < 8; j++) { CButtonUI* pOne = new CButtonUI(); pOne->ApplyAttributeList(_T("bordersize=\"1\" bordercolor=\"#FF000000\" width=\"10\" height=\"10\"")); pOne->SetBkColor(Colors[i][j]); pLine->Add(pOne); if (i < 7) { CControlUI* pMargin = new CControlUI(); pMargin->SetFixedWidth(2); pLine->Add(pMargin); } } } SIZE size = GetPaintMgr()->GetInitSize(); MoveWindow( based_point_.x - static_cast<LONG>(size.cx / 2), based_point_.y - size.cy, size.cx, size.cy, FALSE); }
void CDuiFrameWnd::AdaptWindowSize( UINT cxScreen ) { int iX = 968, iY = 600; int iWidthList = 225, iWidthSearchEdit = 193; SIZE szFixSearchBtn = {201, 0}; if(cxScreen <= 1024) // 800*600 1024*768 { iX = 775; iY = 470; } else if(cxScreen <= 1280) // 1152*864 1280*800 1280*960 1280*1024 { iX = 968; iY = 600; } else if(cxScreen <= 1366) // 1360*768 1366*768 { iX = 1058; iY = 656; iWidthList += 21; iWidthSearchEdit += 21; szFixSearchBtn.cx += 21; } else // 1440*900 { iX = 1224; iY = 760; iWidthList += 66; iWidthSearchEdit += 66; szFixSearchBtn.cx += 66; } CControlUI *pctnPlaylist = m_PaintManager.FindControl(_T("ctnPlaylist")); CControlUI *peditSearch = m_PaintManager.FindControl(_T("editSearch")); CControlUI *pbtnSearch = m_PaintManager.FindControl(_T("btnSearch")); if (pctnPlaylist && peditSearch && pbtnSearch) { pctnPlaylist->SetFixedWidth(iWidthList); peditSearch->SetFixedWidth(iWidthSearchEdit); pbtnSearch->SetFixedXY(szFixSearchBtn); } ::SetWindowPos(m_PaintManager.GetPaintWindow(), NULL, 0, 0, iX, iY, SWP_FRAMECHANGED|SWP_NOZORDER|SWP_NOACTIVATE); CenterWindow(); }