Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Changing the color of MainMenu
I would likt to change the color of MainMenu control in a MDI form using Windows API,so I derived a FMainMenu class from MainMenu and added one method named SetMenuBkColor.Here is my code
public class FMainMenu : System.Windows.Forms.MainMenu
private static extern long SetBkColor(int hdc,long color);
private static extern int GetDC(int hwnd);
public void SetMenuBkColor(long ColorRef)
And I call this method later in my form load event like this:
to make the menu color white.But it doesn't work properly and the color doesn't change.I know there is a problem with calling API,maybe casting isn't correct or something else.
Any one can tell me what happens with this code and what's wrong with it?