static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Start an application context and run one form inside it SpreadsheetApplicationContext appContext = SpreadsheetApplicationContext.GetAppContext(); Form1 instance = new Form1(); appContext.RunForm(instance); if (args.Length > 0) { instance.openFile(args[0]); } Application.Run(appContext); }
/// <summary> /// Creates a new window with a fresh spreadsheet, running on the same thread as the current sheet /// </summary> /// <param name="sender">"new" menu button object that sent the event</param> /// <param name="e">Event to be handled</param> private void newToolStripMenuItem_Click(object sender, EventArgs e) { SpreadsheetApplicationContext.GetAppContext().RunForm(new Form1()); }