Exemple #1
0
        static void Main()
        {
            //log4net.Config.BasicConfigurator.Configure(new log4net.Appender.FileAppender(new log4net.Layout.PatternLayout("%d [%t] %-5p %c [%x] - %m%n"), "log-file.txt")); 
            Application.EnableVisualStyles();
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException);
            Application.SetCompatibleTextRenderingDefault(false);
            //解决Cross-thread operation not valid的问题
            //Control.CheckForIllegalCrossThreadCalls = false;

            _mainform = new MainForm();
            Application.Run(_mainform);            
        }
Exemple #2
0
 private void menuItemNewWindow_Click(object sender, System.EventArgs e)
 {
     try
     {
         MainForm newWindow = new MainForm();
         newWindow.Text = newWindow.Text + " - New";
         newWindow.Show();
     }
     catch (Exception ex)
     {
         Program.ShowMessageBox("MainForm", ex);
     }
 }