I want to center a control (e.g. numeric thermometer) on a decoration and therefore use GetCtrlBoundingRect(...) to calculate the control position. If the control is higher than the decoration i adjust its height. After Setting the new height I call again GetCtrlBoundingRect(...) to calculate the coordinates to center it, but in the second call the function returns a value for the rect height that is much higher than the real control rect height.
Has anybody encountered the same problems and knows a solution?
Here is a code exmaple:
I wrote a small test program, which consists only of following lines concerning the control.
The control in the example is a numeric
thermometer with no title, visible digital display and an original height of about 250.
GetCtrlBoundingRect(panel, control, &top, &left, &height, &widht);
// returns height = 220
SetCtrlAttribute(panel, control, ATTR_HEIGHT, 50);
GetCtrlBoundingRect(panel, control, &top, &left, &height, &widht);
// returns height = 220 or slight smaller value
While trying around I found that the following code example seems to return the correct value in the second call to GetCtrlBoundingRect.
GetCtrlBoundingRect(panel, control, &top, &left, &height, &widht);
// returns height = 220
SetCtrlAttribute(panel, control, ATTR_HEIGHT, 50);
SetCtrlAttribute(panel, control, ATTR_HEIGHT, 50);
GetCtrlBoundingRect(panel, control, &top, &left, &height, &widht);
// returns height = 80