Example #1
0
        private void Form1_MouseWheel(object sender, MouseEventArgs e)
        {
            if (toolStripButton2.Checked)
            {
                if (e.Delta > 0)
                {
                    zoom.ZoomIn();
                }
                else
                {
                    zoom.ZoomOut();
                }
            }
            else
            {
                E += 1 * Math.Sign(e.Delta);

                foreach (PointF[] segment in MathGraphic.Tabulate(QDotPlus, x1, x2, h))
                {
                    listik.Add(segment);
                }

                mgQDotPlus.GraphicLayersPoints = listik.ToArray();
            }
            Refresh();
        }
Example #2
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ox  += e.X - mx;
                oy1 += e.Y - my;

                Refresh();
            }
            if (e.Button == MouseButtons.Right)
            {
                E = -(e.Y - oy1) / zoom.Y;

                foreach (PointF[] segment in MathGraphic.Tabulate(QDotPlus, x1, x2, h))
                {
                    listik.Add(segment);
                }

                mgQDotPlus.GraphicLayersPoints = listik.ToArray();

                Refresh();
            }
        }
Example #3
0
File: Form1.cs Project: a-27m/vssdb
        private void buttonGO_Click(object sender, EventArgs e)
        {
            MathGraphic m;

            #region in/out
            try
            {
                sigma = double.Parse(textBoxSigma.Text);
                f     = double.Parse(textBoxF.Text);
                mju   = double.Parse(textBoxMju.Text);
                a1    = float.Parse(textBoxX1.Text);
                a2    = float.Parse(textBoxX2.Text);
            }
            catch (FormatException)
            {
                MessageBox.Show("Wrong number format");

                textBoxSigma.Text = sigma.ToString();
                textBoxF.Text     = f.ToString();
                textBoxMju.Text   = mju.ToString();
                textBoxX1.Text    = a1.ToString();
                textBoxX2.Text    = a2.ToString();

                return;
            }
            #endregion

            List <PointF> pts = new List <PointF>();
            PointF[][]    Y;
            if (radioAS.Checked)
            {
                grsAS.Clear();

                m = new MathGraphic(Color.Green, DrawModes.DrawLines,
                                    SigmaAPlus, a, a1, a2, h);
                grsAS.Add(m);
                m = new MathGraphic(Color.Green, DrawModes.DrawLines,
                                    SigmaAMinus, a, a1, a2, h);
                grsAS.Add(m);

                Y = MathGraphic.Tabulate(SigmaAPlus, a, a1, a2, h);
                for (int i = 0; i < Y.Length; i++)
                {
                    pts.AddRange(Y[i]);
                }

                Y = MathGraphic.Tabulate(SigmaAMinus, a, a1, a2, h);
                for (int i = 0; i < Y.Length; i++)
                {
                    pts.AddRange(Y[i]);
                }
            }
            if (radioAF.Checked)
            {
                grsAF.Clear();

                m = new MathGraphic(Color.Green, DrawModes.DrawLines,
                                    fA, a, a1, a2, h);
                grsAF.Add(m);

                Y = MathGraphic.Tabulate(fA, a, a1, a2, h);
                for (int i = 0; i < Y.Length; i++)
                {
                    pts.AddRange(Y[i]);
                }
            }

            arPts = pts.ToArray();
            Array.Sort <PointF>(arPts, (Comparison <PointF>)
                                delegate(PointF A, PointF B)
            {
                return(Math.Sign(A.X - B.X));
            });

            ball = new Ball(-1, 1, 20 / zoom);
            timer1.Start();

            pictureBox1.Refresh();
        }