예제 #1
0
        public MainForm()
        {
            InitializeComponent();
            mMandelbrotGenerator        = new MandelbrotGenerator(Width, Height);
            mMandelbrotGenerator.Width  = panel1.Width;
            mMandelbrotGenerator.Height = panel1.Height;
            mMandelbrotGenerator.FixAspect();
            mMandelbrotGenerator.MandlebrotReady          += MMandelbrotGenerator_MandlebrotReady;
            mMandelbrotGenerator.MandlebrotPaletteChanged += MMandelbrotGenerator_MandlebrotPaletteChanged;
            MouseWheel += Form1_MouseWheel;
            UpdateMandelbrot();
            propertyGrid1.SelectedObject = mMandelbrotGenerator;
            //Load the presets from presets.xml (if it exists), and use the defaults otherwise
            string xmlpath = Path.GetDirectoryName(Application.ExecutablePath) + "\\presets.xml";

            if (File.Exists(xmlpath))
            {
                //try loading
                try
                {
                    mPresets = MandelbrotPresets.FromXml(File.ReadAllText(xmlpath));
                }
                catch
                {
                    mPresets = MandelbrotPresets.GenerateDefault();
                    SavePresets();
                }
            }
            else
            {
                mPresets = MandelbrotPresets.GenerateDefault();
                SavePresets();
            }
            UpdatePresets();
        }
예제 #2
0
 //When the reset presets button has been clicked
 private void toolStripButton3_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to result the presets to the defaults?", "Reset", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         mPresets = MandelbrotPresets.GenerateDefault();
         SavePresets();
         UpdatePresets();
     }
 }