コード例 #1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string msg = "";

            if (dlgSaveFile.ShowDialog() == DialogResult.OK)
            {
                if (DrawingSerializer.SaveToBinary(drawing, dlgSaveFile.FileName, ref msg))
                {
                    MessageBox.Show("Your drawing was saved.");
                }
                else
                {
                    MessageBox.Show("Your drawing cound not be saved because this error happened: \n" + msg);
                }
            }
        }
コード例 #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string  msg = "";
            Drawing temp;

            if (dlgOpenFile.ShowDialog() == DialogResult.OK)
            {
                temp = DrawingSerializer.LoadFromBinary(dlgOpenFile.FileName, ref msg);
                if (temp == null)
                {
                    MessageBox.Show("Your drawing could not be loaded because this error happened:\n" + msg);
                }
                else
                {
                    drawing = temp;
                }
            }
            panDrawing.Invalidate();
        }