我试图防止MenuStrip控件受到视觉样式的影响。
所以我用简单的菜单条和禁用的视觉样式创建了简单的表单Main():
// Application.EnableVisualStyles(); <-- no visual styles
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
这会产生这种外观(注意灰色边框和背景):

现在我想以这种形式的其他控件受视觉样式影响的方式做同样的事情(我只想禁用此下拉菜单的视觉样式)。
因此,起初我尝试禁用DropDownevery 的视觉样式ToolStripMenuItem,但没有奏效。然后我尝试禁用整个视觉样式MenuStrip,但那个都不起作用。
这是我的自定义 MenuStrip 的代码:
class MPMenuStrip : MenuStrip
{
    [DllImportAttribute("uxtheme.dll")]
    private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
    protected override void OnHandleCreated(EventArgs e)
    {
        // first attempt:
        foreach (ToolStripMenuItem menuItem in this.Items)
            SetWindowTheme(menuItem.DropDown.Handle, "", "");
        // second attempt:
        SetWindowTheme(this.Handle, "", "");
        base.OnHandleCreated(e);
    }
}
尽管使用了自定义控件MenuStrip,但Application.EnableVisualStyles();在调用 in时Main(),表单的外观如下(蓝色):

有什么想法可能会影响此下拉列表的外观吗?
我错过了什么?
谢谢。