Example #1
0
        void solver_DebugMaxMin(FractionPoint max, FractionPoint min, Fraction f_tan)
        {
            if (df == null)
            {
                df      = new DekartForm(100, 100, 100, 100);
                df.Text = "max & min";
            }

            // n
            df.AddPolygon(Color.Black, DrawModes.DrawLines,
                          new PointF(1000, f_tan * 1000),
                          new PointF(-1000, -f_tan * 1000));

            int id1 = df.AddPolygon(Color.Orange, DrawModes.DrawLines,
                                    new PointF(1000 + max.X, -1 / f_tan * 1000 + max.Y),
                                    new PointF(-1000 + max.X, 1 / f_tan * 1000 + max.Y));
            int id2 = df.AddPolygon(Color.CornflowerBlue, DrawModes.DrawLines,
                                    new PointF(1000 + min.X, -1 / f_tan * 1000 + min.Y),
                                    new PointF(-1000 + min.X, 1 / f_tan * 1000 + min.Y));

            df.Update2();

            df.AddPolygon(Color.Orange, 3f, DrawModes.DrawPoints, new PointF(max.X, max.Y));
            df.AddPolygon(Color.CornflowerBlue, 3f, DrawModes.DrawPoints, new PointF(min.X, min.Y));

            df.Show();
            df.Update2();
        }
Example #2
0
        void solver_DebugPolygonEvent(FractionPoint[] polygon)
        {
            PointF[] pts = new PointF[polygon.Length];
            for (int i = 0; i < polygon.Length; i++)
            {
                pts[i] = new PointF((float)polygon[i].X.Value, (float)polygon[i].Y.Value);
            }

            if (df == null)
            {
                df         = new DekartForm(75, 75, 50, 100);
                df.Text    = this.Text + " - графическое решение";
                df.Closed += new EventHandler(delegate(object sender, EventArgs e)
                {
                    df = null;
                });
                //df.WindowState = FormWindowState.Maximized;
            }
            //df.RemoveAllGraphics();
            df.AddPolygon(Color.Black, DrawModes.DrawFilledPolygon, pts);
            df.Show();
            df.Update2();
        }