this is my code: IMPLEMENT_DYNAMIC(CAUICheckBox, CButton) CAUICheckBox::CAUICheckBox() { m_bCheckBtn=FALSE; m_bPressBtn=FALSE; m_bOldTemp=FALSE; m_clrHigh=globalData.clrHilite; m_clrCheck=RGB(0,0,0);//RGB(0,170,170); m_bSelected=FALSE; m_Checked = FALSE; } CAUICheckBox::~CAUICheckBox() { } BEGIN_MESSAGE_MAP(CAUICheckBox, CButton) ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_ERASEBKGND() ON_WM_MOUSEMOVE() ON_WM_MOUSEOUT() ON_WM_KEYDOWN() ON_MESSAGE(BM_SETCHECK, OnSetCheck) ON_MESSAGE(BM_GETCHECK, OnGetCheck) END_MESSAGE_MAP() // CAUICheckBox message handlers BOOL CAUICheckBox::OnEraseBkgnd(CDC *pDC) { return TRUE; } LRESULT CAUICheckBox::OnGetCheck(WPARAM wParam, LPARAM lParam) { return m_Checked; } // End of OnGetCheck void CAUICheckBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { CDC *pDC=CDC::FromHandle(lpDrawItemStruct->hDC); CRect m_rcClient=lpDrawItemStruct->rcItem; UINT m_State=lpDrawItemStruct->itemState; CBrush cb; CRect m_rcTemp=m_rcClient; CPoint pt; CSize m_Csize; CString m_szCaption; COLORREF m_Over=RGB(255,193,111); CPen cpOver(PS_SOLID,1,RGB(255,193,111)); int iMode=pDC->SetBkMode(TRANSPARENT); int iExtile=GetButtonStyle(); //obtenemos orientación del texto CRect m_rcText=m_rcClient; GetWindowText(m_szCaption); if(m_szCaption.GetLength() > 1) m_Csize= pDC->GetTextExtent(m_szCaption); //de acuerdo a la alineación del texto prepare la ubicación //del texto para Drawtex y DrawState if (m_rcClient.Height() > 13) { int Dif=m_rcClient.Height()-13; Dif/=2; m_rcTemp.top=Dif; m_rcTemp.bottom=m_rcTemp.top+13; } if (iExtile & BS_LEFTTEXT) { m_rcTemp.left= m_rcTemp.right-13; pt=CPoint(m_rcTemp.left,m_rcTemp.top+1); } else { m_rcTemp.right= m_rcTemp.left+13; pt=CPoint(m_rcTemp.right+2,m_rcTemp.top+1); m_rcText.left=m_rcTemp.right+1; } //draw frame of checkbox pDC->FillSolidRect(m_rcTemp,globalData.clrWindow); pDC->Draw3dRect(m_rcTemp,globalData.clrBtnDkShadow,globalData.clrBtnHilite);//clrBtnLight); m_rcTemp.DeflateRect(1,1); pDC->Draw3dRect(m_rcTemp,globalData.clrBtnShadow,globalData.clrBtnFace); //DrawOrange(pDC,m_rcTemp); m_rcTemp.DeflateRect(1,1); if (lpDrawItemStruct->itemState & ODS_DISABLED) pDC->DrawState(pt, m_Csize, m_szCaption, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL); else { pDC->DrawText(m_szCaption,m_rcText,DT_SINGLELINE|DT_LEFT|DT_VCENTER); if(lpDrawItemStruct->itemState & ODS_SELECTED||m_Checked) {
MaTrIX2k2
Posts
-
Problems with a check box -
Problems with a check boxI've made my own check box and put it into my dialog, everything is fine, but when i call the DDX_Check, this return no value, i've used a BOOL option to set as true or false, when is checked or unchecked, but nothing happens, nothing is registered, my check box is a CButton derived class, what's wrong?
-
How to replace the ScrollBar on a List & Combo BoxI've thought that too, but if i do, i'll have to map the mouse and key events by my own, i only want to replace the classic scroolbar by one of my own, withou mapping the events, is there another way?:confused:
-
How to replace the ScrollBar on a List & Combo BoxI want to replace it by one of my own ;P
-
How to access protected member of CDockBarbut i can't believe that, the GetDockedControlBar is supposed to be protected member and not private, so how can i acces this?
-
How to access protected member of CDockBarnew error "syntax error : CDockBarEx", now this error appear, i'm confused???
-
How to access protected member of CDockBarI've derived a class from CDockBar, it's called CDockBarEx but i still having the same problem, why is this?
-
How to access protected member of CDockBarI need to get the GetDockedControlBar option of CDockBar, but it says that is a protected member, how can i access to this?
-
CDockContextIf i'm using the CDockContext, how can i take a picture of the bar that's using this, i want to know this to try to make a code similar so the one in OXP.
-
Showing content of wnd while movingIs there anyway to make an window that shows the content while moving(dragging), the toolbars don't have this also if i disable that option on the main window setting i won't see the content, so i want to make something to this, could anybody help me?:)
-
Is ther anyway to disable the menu animations for menusOnly for my selected menus, not all.
-
n i disableHow can i disable the shadows for the menus...How can i disable the shadows for my CMenu derived class without disabling the shadows for the main menus under Windows XP?
-
AnimateWindow(), problemMy Window is a CMiniFrameWnd, and i added this, so i don't get anything to be shown, what's wrong?
-
AnimateWindow(), problemWhen i use the AnimateWindow my window is animated, but i don't see any control, my OnPaint() is not called, why?
-
Get Icons from ToolBarsNot To the toolbar, i only want to get the icons from the toolbar to draw it to my menu, a bitmapped fakemenu.
-
Get Icons from ToolBarsI've made a menu using a Window, but i need to know how to get the icons from the toolbars. :confused:
-
Can't use the CMenu options in the OnPaint under VC++ 7I'm trying to get the strings of my CMenu, but it returns an error, why is this? :confused:
-
ReleaseDC is not workingis not working either :confused:
-
ReleaseDC is not workingI'm making a window that acts as a menu, see: this is my command: ShowMenu(BOOL bFromKey, int x, int y,CWnd* pParent, HMENU hMenu) and i have a CMenu named m_pMenu i convert the hMenu into a CMenu: m_pMenu->m_hMenu = hMenu; this is ok, now i create my window using the CreateEx command, after my window is created i call another class called DrawMenuItem, this one get the size of all the menuitems stored in the m_pMenu, after get the size of the items, i assing the size to the window using the MoveWindow, after this the window is showed using the ShowWindow, then i call the ReleaseDC to make m_pMenu free for use for every class, but here's the problem when the menu is showed it call the OnPaint, in this i paint the background and i draw the menu text for the menuitems, but the m_pMenu is empty in this, why if it's supposed to be the m_pMenu of the ShowMenu command?
-
ReleaseDC is not workingwhy ReleaseDC is not saving my information.