Exemplo n.º 1
0
        private void ReturnBMP(Bitmap bmp, FigureList list)
        {
            Graphics graph = Graphics.FromImage(bmp);

            graph.Clear(HolstPanel.BackColor);
            list.Display(graph);
            HolstPanel.Image = bmp;
        }
Exemplo n.º 2
0
        private void ButtonOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "Файлы .lin | *.lin";
            openFileDialog.InitialDirectory = "c:\\";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (File.Exists(openFileDialog.FileName))
                    {
                        FileStream      fileStream = new FileStream(openFileDialog.FileName, FileMode.Open);
                        BinaryFormatter bfser      = new BinaryFormatter();
                        list = (FigureList)bfser.Deserialize(fileStream);
                    }
                }
                catch
                {
                    MessageBox.Show("Unable to open file");
                }
            }
        }