static void Painter_KeyDown(object sender, PainterKeyEventArgs e) { if (Painter.IsKeyDown(Keys.LControlKey)) { if (e.KeyCode == Keys.S) { SaveFileDialog dialog = new SaveFileDialog() { Filter = "Console buffer files|*.cbuf", Title = "Save Drawing Buffer" }; if (dialog.ShowDialog() == DialogResult.OK) { try { paintBuffer.Save(dialog.FileName); } catch (Exception ex) { MessageBox.Show("Error while saving:\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else if (e.KeyCode == Keys.O) { OpenFileDialog dialog = new OpenFileDialog() { Filter = "Console buffer files|*.cbuf", Title = "Open Drawing Buffer" }; if (dialog.ShowDialog() == DialogResult.OK) { try { paintBuffer = ConsoleBuffer.FromFile(dialog.FileName); } catch (Exception ex) { MessageBox.Show("Error while opening:\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }