How to Get LPDRAWITEMSTRUCT from CWnd pointer?
-
Hi! I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function: void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { int iCtrl=0; CString sTexto; pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); } This is called by the form class where the button is. With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto) and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know! Thank you for your time! rui
-
Hi! I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function: void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { int iCtrl=0; CString sTexto; pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); } This is called by the form class where the button is. With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto) and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know! Thank you for your time! rui
How can i assign a value to the LPDRAWITEMSTRUCT struct parameters? I tried : void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { CRect rc; pDIS->itemAction = ODA_DRAWENTIRE; <-error pDIS->hwndItem = pWnd->GetSafeHwnd(); <-error pDIS->hDC = (HDC)pWnd->GetDC(); <-error pWnd->GetWindowRect(rc); pDIS->rcItem = rc; <-error CString sTexto; //desactiva a o botao e os seus tooltips pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); //vai buscar ourtros dados do botao iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); //passa o estado do botao para uma member variavel bDisabled=bEnable; DrawButton(iCtrl, pDIS, sTexto); } having BOOL bDisabled; int iCtrl; LPDRAWITEMSTRUCT pDIS; as member variables Thank you