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?
0 · ·