View Full Version : menu ctls and background
mroskothen
04-01-2002, 01:45 PM
Hi, how can I change the background color of a menu control? I found only SetStyle which doesn't seem to deal with color.
Thanks, Markus
hey Hi ,
Try Using IMENUCTL_SetColors(...) API which will do the color settings for the menu control for u. U will be able to change the text color , the BG color , selection color ...etc
have a nice time .
bye
raja
Yao Ningbo
04-01-2002, 11:53 PM
Hi , raja
You may be right. But after I look through the documents, I found the description of the IMenu_SetColor() is unclear.
For example, in BREWAPIRefrence the writer talked about AEEMenuColors, AEEMenuColorsMask and IMENUCTL_SetColors(), but he didn't depict how to use them togather.
So, at last I are not able to use the function.
hi
just check out this sample code below. it will work .
AEEMenuColors menuclr;
.......
......
........
menuclr.wMask = 0xFFFF ; //Mask of bits to pay attention to in this struct
menuclr.cBack = MAKE_RGB(255,255,255);//MAKE_RGB(255,102,204);
menuclr.cText = MAKE_RGB(0xFF,0xFF,0xFF); // Text color for unselected items and Arrows
//menuclr.cSelBack = MAKE_RGB(204,51,102); //Background color for selected items
menuclr.cSelBack = MAKE_RGB(0,0,0);
menuclr.cSelText =MAKE_RGB(0xff,0xff,0xff); //Text color for selected items
menuclr.cFrame = MAKE_RGB(255,102,204); //Simple frame color
menuclr.cScrollbar =MAKE_RGB(204,51,102); //Scrollbar frame color
menuclr.cScrollbarFill= MAKE_RGB(204,51,102);//Scrollbar fill color
menuclr.cTitle = MAKE_RGB(204,51,102); //Background of title text
menuclr.cTitleText =MAKE_RGB(0xff,0xff,0xff); //Color of title text
IMENUCTL_SetColors(pMe->m_pIconMenu,&(menuclr));
regards
raja
Yao Ningbo
04-04-2002, 12:22 AM
Thanks for your code. You are right. There is just one reason that the writer of the documents is not good.
Now I have another question that how can I insert a icon into menu item.
Could you tell me the reason?
arunbangari
04-04-2002, 01:24 PM
Hi,
You need to use CtlAddItem structure to populate or add the menu item. The code goes like this.
m_pIImage=ISHELL_LoadImage(pMe->a.m_pIShell,"golf.bmp");//Load the image(Icon)
if(pMe->m_pIImage)
{
pai.pText = NULL;
pai.pImage = m_pIImage;
pai.pszResImage= NULL;
pai.pszResText = RES_FILE;
pai.wFont = AEE_FONT_BOLD;
pai.dwData = NULL;
pai.wText = IDS_TEXT;
pai.wItemID = IDS_TEXT;
IMENUCTL_AddItemEx(m_pIStdMenu,&pai);
releaseImage(pMe);
}
For more information on CtlAddItem you can refer the BREW SDK.
Regards
Arun Bangari
Yao Ningbo
04-04-2002, 08:57 PM
Thank you.
Could you tell me the type of pai ?
The information about it can not be found in the SDK.:(
Yao Ningbo
04-04-2002, 09:02 PM
I make a mistake;) . The type of pai should be CtlAddItem.
Thanks.:)
arunbangari
04-04-2002, 09:39 PM
You are always welcome. In my code i had used a function releaseImage(pMe). Its not an API and it contans the code to release the Image interface
Thanks:D
Yao Ningbo
04-07-2002, 09:24 PM
I solved that question before you pasted the answer.:cool:
Ha ha!:D
vBulletin v3.0.13, Copyright ©2000-2009, Jelsoft Enterprises Ltd.