void PrepareWindow() { cxBorder = GetSystemMetrics(SM_CXBORDER); cyBorder = GetSystemMetrics(SM_CYBORDER); nItems = windowCount; nCols = min(max(nItems,8),12); nRows = (nItems+nCols-1)/nCols; itemsW = nCols*32 + (nCols+1)*8; itemsH = nRows*32 + (nRows+1)*8; totalW = itemsW + 2*cxBorder + 4; totalH = itemsH + 2*cyBorder + fontHeight + 8; // give extra pixels for the window title xOffset = 8; yOffset = 8; if (nItems < nCols) { int w2 = nItems*32 + (nItems-1)*8; xOffset = (itemsW-w2)/2; } ResizeAndCenter(switchdialog, totalW, totalH); }
void PrepareWindow(VOID) { nItems = windowCount; nCols = CoolSwitchColumns; nRows = (nItems + CoolSwitchColumns - 1) / CoolSwitchColumns; if (nRows > CoolSwitchRows) { nRows = CoolSwitchRows; nItems = nRows * nCols; } itemsW = nCols * CX_ITEM_SPACE; itemsH = nRows * CY_ITEM_SPACE; totalW = itemsW + 2 * DIALOG_MARGIN; totalH = itemsH + 2 * DIALOG_MARGIN; totalH += fontHeight + 2 * CY_TEXT_MARGIN; ResizeAndCenter(switchdialog, totalW, totalH); }