|
-
October 9th, 2005, 10:08 AM
#1
Removing the border of the popupmenu
Hi
I am trying to create ownerdraw popup menus,
Using my own class derived from CMenu
I am handling both mesureitem and drawitem functions for the same.
In drawitem I either draw some text or I load some bitmaps
and I change the color of the menu.
But there is White color border appearing which cannt be removed by framerect function.
Is there any method to remove that border?
-
October 11th, 2005, 08:02 AM
#2
Re: Removing the border of the popupmenu
somebody please help.......
-
October 11th, 2005, 08:21 AM
#3
Re: Removing the border of the popupmenu
How do you draw the menu background color?Post some code.
Please use code tags [code] [/code]
We would change the world, but God won't give us the sourcecode.. 
Undocumented futures are fun and useful....
_________
Gili
-
October 14th, 2005, 05:10 AM
#4
Re: Removing the border of the popupmenu
 Originally Posted by g_gili
How do you draw the menu background color?Post some code.
void CustMenu::MeasureItem(LPMEASUREITEMSTRUCT lpm)
{
UINT height=20;
UINT width=30;
lpm->itemWidth =width;
lpm->itemHeight = height;
}
void CustMenu:: DrawItem(LPDRAWITEMSTRUCT lpd) {
CDC* pDC = CDC::FromHandle(lpd->hDC);
CBrush br=RGB(250,250,250);
pDC->FillRect(&lpd->rcItem, &br);
CMenu:: DrawItem(lpd);
}
Last edited by Omkar_Parkhi; October 14th, 2005 at 05:16 AM.
-
October 14th, 2005, 02:32 PM
#5
Re: Removing the border of the popupmenu
The problem you have is that the border is not part of your owner drawn menu. When a menu is popped up a window is created which has the border you need to remove. Handling the WM_MEASUREITEM / WM_DRAWITEM is not enough. THis only is used to set the size of the window and to draw onto it.
You need to hook the creation of this window and change its style. Isf you set a hook and catch WM_CREATE messages and loook for a window class of "#32768" you should be able at that point to set the border style so that the menu will not be shown with a border.
Also, remember that not all menus use the window class name of #32768, so you may find that you will have to check for other class names also.
I cant remeber the other class names that you would expect to see, but a search should turn them up for you.
Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
Please remember to rate useful answers. It lets us know when a question has been answered.
-
October 15th, 2005, 12:56 AM
#6
Re: Removing the border of the popupmenu
 Originally Posted by Roger Allen
You need to hook the creation of this window and change its style. Isf you set a hook and catch WM_CREATE messages and loook for a window class of "#32768" you should be able at that point to set the border style so that the menu will not be shown with a border.
Also, remember that not all menus use the window class name of #32768, so you may find that you will have to check for other class names also.
I cant remeber the other class names that you would expect to see, but a search should turn them up for you.
Hi Roger,
Can you be bit elaborative on this issue?
Well I am rookie in VC++
just started coding a month ago..
So Its difficult for me to understand some of the things you are talking about...
My class CustMenu is derivred fromCMenu..
Shall I handle WM_CREATE in that and
In OnCreate( LPCREATESTRUCT lpCreateStruct );
I check whether
"LPCSTR lpszClass=#32768 " ?
If what I understodd is right..
Then how I change styles here?
In tOnCreate Method?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|