I like to autosize the owner draw button depending upon the text that it load dynamically based on localization strings. so some strings are large than others. Keeping this I override DrawItem in the inherited class from CButton. The sample code is below void CMyGraphicButton::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct) { CString cs; CString cslong; ASSERT(lpDrawItemStruct->CtlType == ODT_BUTTON); LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData; if (!lpszText || lpszText == (LPCTSTR)-1) { GetWindowText (cs); } else cs = lpszText; // now i m trying to resize , so let try to increase the size of button unconditioally // I get //lpDrawItemStruct>rcItem.left =0 //lpDrawItemStruct>rcItem.right =75 //lpDrawItemStruct>rcItem.top = 0 //lpDrawItemStruct>rcItem.bottom = 25 //As my button is on extreme right side of dialog so i tried to extend/increase the size of // button of the left side as follows lpDrawItemStruct>rcItem.left -= 25 ; // but the above causes the text to be moved on right side insead of resize/increase the //button size. Any idea or help is appriciated. Thanks Anil }
[AKS]