how can i do the control autosize?
i think in these way:
1 - get the text rect:
RECT textrect;
int a=DrawText (test->hDC,inst->strCaption.c_str(),-1,&textrect,DT_CALCRECT);
(the a isn't zero)
2 - testing the rectangle with image size:
if(textrect.bottom<inst->imgtest.height())
inst->intHeight=inst->imgtest.height();
if(textrect.right<inst->imgtest.width())
inst->intWidth=inst->imgtest.width();
3 - change the control size:
SetWindowPos(inst->hwnd, 0, 0, 0, inst->intWidth, inst->intHeight,
SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOCOPYBITS);
so why the control size isn't changed? did i forget something?