Menu Font problem [modified]
-
Hi I am trying the change the default font of the menu. I have used code from http://www.codeproject.com/menu/menuch.asp. In the App file,there are AppendMenu(),DrawItem() overriden functions. Under drawItem(),I have written the code to change the default font of the Menu.I have declared objects like m_FileMenu, m_EditMenu of type App class in the Mainframe header file and through these variables I have called AppendMenu() from within the constructor of Mainframe class. Like m_FileMenu.CreatePopupMenu(); m_FileMenu.AppendMenu(MF_ENABLED,ID_MYFILE_NEW,"&New\tCtrl+N"); m_FileMenu.AppendMenu(MF_ENABLED,ID_FILE_OPEN,"&Open\tCtrl+O"); Similarly, I have called AppendMenu()for m_EditMenu object also. Next,Under CreateMenu()which has been called from OnCreate handler,I have taken the pointer of CMenu through GetMenu(), and all the default items of menu have been removed through RemoveMenu(). Like pMenu->RemoveMenu(0,MF_BYPOSITION); Then,through that CMenu pointer,I have called InsertMenu() through which all the appended items are getting inserted in the menu. Like pMenu->InsertMenu(0,MF_BYPOSITION|MF_POPUP, (UINT)m_FileMenu.m_hMenu,"&File"); pMenu->InsertMenu(1,MF_BYPOSITION|MF_POPUP, (UINT)m_EditMenu.m_hMenu,"&Edit"); Now,the problem is that although the font of all the submenu items are getting changed as per my given font in the drawitem(), but the font of menu items like "File" and "Edit" are not getting changed. If possible Can you please tell me what could be the reason behind it and what should I do to solve it? -- modified at 5:23 Monday 23rd April, 2007
With Regards Neeraj Sinha Netstudio Pune
-
Hi I am trying the change the default font of the menu. I have used code from http://www.codeproject.com/menu/menuch.asp. In the App file,there are AppendMenu(),DrawItem() overriden functions. Under drawItem(),I have written the code to change the default font of the Menu.I have declared objects like m_FileMenu, m_EditMenu of type App class in the Mainframe header file and through these variables I have called AppendMenu() from within the constructor of Mainframe class. Like m_FileMenu.CreatePopupMenu(); m_FileMenu.AppendMenu(MF_ENABLED,ID_MYFILE_NEW,"&New\tCtrl+N"); m_FileMenu.AppendMenu(MF_ENABLED,ID_FILE_OPEN,"&Open\tCtrl+O"); Similarly, I have called AppendMenu()for m_EditMenu object also. Next,Under CreateMenu()which has been called from OnCreate handler,I have taken the pointer of CMenu through GetMenu(), and all the default items of menu have been removed through RemoveMenu(). Like pMenu->RemoveMenu(0,MF_BYPOSITION); Then,through that CMenu pointer,I have called InsertMenu() through which all the appended items are getting inserted in the menu. Like pMenu->InsertMenu(0,MF_BYPOSITION|MF_POPUP, (UINT)m_FileMenu.m_hMenu,"&File"); pMenu->InsertMenu(1,MF_BYPOSITION|MF_POPUP, (UINT)m_EditMenu.m_hMenu,"&Edit"); Now,the problem is that although the font of all the submenu items are getting changed as per my given font in the drawitem(), but the font of menu items like "File" and "Edit" are not getting changed. If possible Can you please tell me what could be the reason behind it and what should I do to solve it? -- modified at 5:23 Monday 23rd April, 2007
With Regards Neeraj Sinha Netstudio Pune
Menu will be drawn as per the system font settings. You can try with Owner-Drawn menu Search CP to find more articles on it.
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
-
Menu will be drawn as per the system font settings. You can try with Owner-Drawn menu Search CP to find more articles on it.
-Sarath_._ "Great hopes make everything great possible" - Benjamin Franklin
My blog - Sharing My Thoughts, An Article - Understanding Statepattern
Thanks for your reply I have tried with Owner-Drawn menu.The menu items font didn't change.Only the submenu items font got changed.I have used code from the CP itself: http://www.codeproject.com/menu/menuch.asp.
With Regards Neeraj Sinha Netstudio Pune