コード例 #1
0
        }// Program-End with Exit-Button

        private async void button_Start_Click(object sender, EventArgs e)
        {
            // Generation of MainMathode instance
            MainMethods Ausgabe = new MainMethods();

            // Definition and Initiation
            Random rand = new Random(); // generation of instance of Random-class. in case of (number) = defined random value
            int    size = 500;          // definition of scale of playground

            // Definition of output window and return control instance
            Control outputWin = Ausgabe.OutPut_Window(size); // return Graphics instance for further use

            // Generation of PicturBox (w/ image) for graphic plotted in
            PictureBox Field = Ausgabe.GenPicBox(outputWin, size);

            // Generation of Graphics instance correlated to image in picturebox
            Graphics g = Graphics.FromImage(Field.Image);

            // Generation of playground
            Point[] playground = Ausgabe.PlayGround(g, size, radioButton_Sirpinski_3rand, radioButton_SquarNoice, radioButton_noRes_23,
                                                    radioButton_SquareRest1, radioButton_SquareRest2, radioButton_SquareRest3, radioButton_CenterPoint_13, radioButton_CenterPoint_23);

            // Definition of restriction etc.
            double [] para = Ausgabe.Para(radioButton_Sirpinski_3rand, radioButton_SquarNoice, radioButton_noRes_23, radioButton_SquareRest1,
                                          radioButton_SquareRest2, radioButton_SquareRest3, radioButton_CenterPoint_13, radioButton_CenterPoint_23, radioButton_secLast,
                                          radioButton_3rdLast);

            // Definition of color
            SolidBrush[] Farbe = Ausgabe.Farbe(radioButton_non);

            // Simulate growth
            await Task.Run(() => Ausgabe.OutPut(Field, g, rand, playground, size, para, Farbe));

            // methode running in async mode -> no freezing of desktop due to long-time calculation duration of this methode

            // Dispose graphic instance
            g.Dispose();
        }
コード例 #2
0
        } // Control of allowed input

        //
        // ------------------------------------------------------------------------------------------------------------------
        //
        // Definition of ToolStripButtons
        private async void toolStripButton_Start_Click(object sender, EventArgs e)
        {
            // new instance: new frame: new instance of NewFrame
            NewFrame outputWin = new NewFrame(size);

            outputWin.Show();

            // Generation of Graphics instance correlated to image in picturebox
            Graphics g = Graphics.FromImage(outputWin.Field.Image);

            //g.Clear(Color.White);

            // Grap parameters from dataGridview2 (they could be modified by user)
            MM0.GetData(dataGridView2, Para);

            // Random Jump by IFS
            await Task.Run(() => MM0.OutPut(outputWin.Field, g, rand,
                                            textBox_XShift, textBox_YShift, textBox_Scaling, size, Para, textBox_IFSName, textBox_Points, radioButton_non));

            // methode running in async mode -> no freezing of desktop due to long-time calculation duration of this methode

            // Dispose graphic instance
            g.Dispose();
        } // calculation of fractal structure by given parameters