| | |
| | | |
| | | BOOL CAccordionWnd::RegisterWndClass() |
| | | { |
| | | WNDCLASS wc; |
| | | WNDCLASS wcExisting = {}; |
| | | HINSTANCE hInstance = AfxGetInstanceHandle(); |
| | | if (::GetClassInfo(hInstance, ACCORDIONWND_CLASS, &wcExisting) || |
| | | ::GetClassInfo(NULL, ACCORDIONWND_CLASS, &wcExisting)) { |
| | | return TRUE; |
| | | } |
| | | |
| | | WNDCLASS wc = {}; |
| | | wc.lpszClassName = ACCORDIONWND_CLASS; |
| | | wc.hInstance = AfxGetInstanceHandle(); |
| | | wc.hInstance = hInstance; |
| | | wc.lpfnWndProc = WindowProc; |
| | | wc.hCursor = ::LoadCursor(NULL, IDC_ARROW); |
| | | wc.hIcon = 0; |
| | |
| | | wc.cbWndExtra = 0; |
| | | |
| | | // 注册自定义类 |
| | | return (::RegisterClass(&wc) != 0); |
| | | if (::RegisterClass(&wc) != 0) { |
| | | return TRUE; |
| | | } |
| | | return (::GetLastError() == ERROR_CLASS_ALREADY_EXISTS); |
| | | } |
| | | |
| | | CAccordionWnd * CAccordionWnd::FromHandle(HWND hWnd) |
| | |
| | | for (size_t i = 0; i < m_vectorItems.size(); i++) { |
| | | ACCORDIONITEM *pItem = m_vectorItems.at(i); |
| | | if (pItem->pWnd != NULL) { |
| | | GetItemRect(rcClient, i, &rcItemClient); |
| | | GetItemRect(rcClient, (UINT)i, &rcItemClient); |
| | | rcItemClient.top += ITEM_HEIGHT; |
| | | if (pItem->nExpandHeight == -1) { |
| | | rcItemClient.bottom = rcClient.bottom; |
| | |
| | | RECT rcItem, rcItemHeader; |
| | | for (size_t i = 0; i < m_vectorItems.size(); i++) { |
| | | ACCORDIONITEM *pItem = m_vectorItems[i]; |
| | | GetItemRect(rcClient, i, &rcItem); |
| | | GetItemHeaderRect(rcClient, i, &rcItemHeader); |
| | | GetItemRect(rcClient, (UINT)i, &rcItem); |
| | | GetItemHeaderRect(rcClient, (UINT)i, &rcItemHeader); |
| | | |
| | | |
| | | // 热点项的背景色和边框 |