Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a custom class inherited from CMenu for the owner draw. I have changed the background color of the pop up menu but i cant change the border color. Please help either to remove the border altogether or change border color. Refer to following image.

https://i.stack.imgur.com/EO309.png[^]

What I have tried:

void CNewMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct)
{
    lpMeasureItemStruct->itemHeight = 100;
    lpMeasureItemStruct->itemWidth = 150;
}

void CNewMenu::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    CRect rectFull(lpDrawItemStruct->rcItem); 
    COLORREF TextRect = COLORREF(RGB(0, 0, 0)); 
    CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
    pDC->FillSolidRect(&rectFull, TextRect);
    pDC->TextOut(rectFull.left, rectFull.top, ((MenuObject*)lpDrawItemStruct->itemData)->m_strCaption);
}
Posted
Updated 3-Dec-21 6:29am
Comments
Richard MacCutchan 2-Dec-21 13:35pm    
The parts you refer to are the non-client area, so you need to respond to the WM_NCPAINT message (Winuser.h) - Win32 apps | Microsoft Docs[^].

1 solution

This article might be helpful : Yet Another Fully Functional Ownerdraw Menu[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900