/// <summary> /// Opens a new spreadsheet form. /// </summary> private void OpenFile() { OpenFileDialog openSS = new OpenFileDialog(); openSS.InitialDirectory = "c:\\"; openSS.Filter = "Spreadsheet File (*.sprd)| *.sprd | All Files (*.*)|*.*"; openSS.DefaultExt = "sprd"; DialogResult r = openSS.ShowDialog(); if (r == DialogResult.OK) { filename = openSS.FileName; try { Form1 temp = new Form1(openSS.FileName); temp.s = new Spreadsheet(filename, s => true, s => s.ToUpper(), "ps6"); SpreadSheetApplicationContext.getAppContext().DisplayForm(temp); HashSet <string> HashNames = new HashSet <string>(temp.s.GetNamesOfAllNonemptyCells()); foreach (string cell in HashNames) { GetAddressOfCell(cell); temp.spreadsheetPanel1.SetValue(column, row, cellValue(cell).ToString()); } temp.DisplaySelection(temp.spreadsheetPanel1); } catch (IOException) { MessageBox.Show("Cannot open File"); } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SpreadSheetApplicationContext appContext = SpreadSheetApplicationContext.getAppContext(); appContext.DisplayForm(new Form1()); Application.Run(appContext); }
/// <summary> /// Creates and shows a new form. /// </summary> private void NewForm() { SpreadSheetApplicationContext.getAppContext().DisplayForm(new Form1()); }