MessageBox显示一些沉闷的主题

时间:2013-10-29 06:07:42

标签: c# winforms telerik messagebox

我有telerik messagebox,在我的windows应用程序中加载启动表单后,设计器模式中的messagebox.show()显示弹出窗口,但在此之前弹出一些枯燥的主题。 我想做的就是展示 我的Program.cs中RadMessageBox.Show(this, "Body", "header", MessageBoxButtons.OK, RadMessageIcon.Info);,这应该是iwindows32window类型。任何帮助将不胜感激

static void Main()
    {//messagebox here displays with dull theme
  Application.Run(new Login());   
//messagebox here displays with original theme
    }

1 个答案:

答案 0 :(得分:1)

如果我理解正确,您在设置应用程序主题之前显示一个消息框,因此消息框没有正确的主题。如果是这样,您可以在显示文本框之前使用以下方法设置其主题:

RadMessageBox.SetThemeName("yourThemeNameHere");

编辑: 您可以尝试以下方法:

  static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        Form f = new Form1(); //this contains some Telerik WinForms controls
        Telerik.WinControls.RadMessageBox.SetThemeName("TelerikMetro");
        Telerik.WinControls.RadMessageBox.Show("test");

        Application.Run(f);
    }