How to get/set the position of buttons, ListCtrl etc.?
-
Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.
-
Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.
Try: RECT stItemRect = {0}; GetDlgItem(IDC_NAME_OF_CONTROL)->GetWindowRect(&stItemRect); This ensures that you are using the correct CWnd item. It gives you all the corners of the item, so you can also work out the size. If this still crashes then I would guess the list control is being declared incorrectly - does it display on screen with those lines commented out? Simon.
-
Hi all, I tried to get/set the position and size of a ListCtrl in a dialog. When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Is it the same way if i want to change the position of buttons and so on? Is anybody out there who can help me with this problem and explain it to me!? (MFC) :(( Thanks P.R.
Wee - Man wrote: When i use the GetClientRect() method i get no values and the programm crashes and starts the debugger. Can you provide a code snippet of what you are doing?
A rich person is not the one who has the most, but the one that needs the least.