I'm trying to make a win32 application consisting of one treeview and one listbox side by side. The problem i'm having is that despite seemingly passing the same size to each control on creation there's a weird offset between the two that I can't explain.....
Relevant code is.......Then bit of CreateTreeView()....Code:LRESULT CALLBACK WndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { PAINTSTRUCT ps; HDC hDC; RECT rc; TEXTMETRIC tm; static HWND hLB; switch (uMsg) { case WM_CREATE: g_hTV = CreateTreeView(hwnd); InitTreeViewItems(g_hTV); GetClientRect(hwnd, &rc); hLB = CreateWindowEx(0, WC_LISTBOX, NULL, WS_CHILDWINDOW | WS_VISIBLE | LBS_STANDARD, (rc.right / 2)+1, 0, rc.right/2, rc.bottom, hwnd,NULL, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);And a pic demostrating what i might have explained poorly...the red bit shows the messed up bit...Code:RECT rcClient; //dim of client area HWND hwndTV; // handle to our treeview InitCommonControls(); GetClientRect(hwndParent, &rcClient); hwndTV = CreateWindowEx(0, WC_TREEVIEW, "Tree View", WS_VISIBLE | WS_CHILD | WS_BORDER | TVS_HASLINES | TVS_HASBUTTONS | TVS_LINESATROOT, 0, 0, rcClient.right/2, rcClient.bottom, hwndParent, NULL, (HINSTANCE)GetWindowLong(hwndParent, GWL_HINSTANCE), NULL);
Anybody had any experience like or any thoughts on what might be causing it? Cheers peeps.




Reply With Quote