Ejemplo n.º 1
0
        // -------------------------------------------------
        public Form_InfinitiveLoop ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("Times New Roman", 14);

            sizefStrs = Auxi_Geometry .MeasureStrings (this, strs);
            hStr = Convert .ToInt32 (sizefStrs [0] .Height);
            Prepare_lrsView ();

            text = new TextMR (this, new Point (450, 100), "Figure - moved by strips, reconfigured by circles\r\n" +
                                                           "Group and text - moved by any inner point");

            ptPolygonCenter = NewPolygonCenter;
            view = View .ReverseCover;
            comboView .SelectedIndex = Convert .ToInt32 (view);

            rand = Auxi_Common .RandomByCurTime (out nSeed);
            numericUD_Points .Value = (numericUD_Points .Minimum + numericUD_Points .Maximum) / 2;
            numericUD_Radius .Value = 15;
            numericUD_HalfStrip .Value = 5;
            int nPoints = Convert .ToInt32 (numericUD_Points .Value);
            Point [] pts = new Point [nPoints];
            for (int i = 0; i < pts .Length; i++)
            {
                pts [i] = new Point (notCloser + rand .Next (nSeed) % (ClientSize .Width - 2 * notCloser),
                                     notCloser + rand .Next (nSeed) % (ClientSize .Height - 2 * notCloser));
            }
            loop = new InfinitiveLoop (pts, Convert .ToInt32 (numericUD_Radius .Value),
                                            Convert .ToInt32 (numericUD_HalfStrip .Value), Color .Blue, Color .Yellow);
            RenewMover ();

            bAfterInit = true;
        }
Ejemplo n.º 2
0
 // -------------------------------------------------        ValueChanged_numericPoints
 private void ValueChanged_numericPoints (object sender, EventArgs e)
 {
     if (bAfterInit)
     {
         int nPoints = Convert .ToInt32 (numericUD_Points .Value);
         Point [] pts = new Point [nPoints];
         switch (view)
         {
             case View .Polygon:
             case View .Canstellation:
             case View .Cover:
             case View .ReverseCover:
                 ptPolygonCenter = NewPolygonCenter;
                 int nR = Math .Min (ClientSize .Width, ClientSize .Height) / 3;
                 for (int i = 0; i < nPoints; i++)
                 {
                     pts [i] = new Point (ptPolygonCenter .X + (int) (nR * Math .Cos (2 * Math .PI * i / nPoints)),
                                          ptPolygonCenter .Y - (int) (nR * Math .Sin (2 * Math .PI * i / nPoints)));
                 }
                 break;
             case View .ColoredLoop:
                 for (int i = 0; i < nPoints; i++)
                 {
                     pts [i] = new Point (notCloser + rand .Next (nSeed) % (ClientSize .Width - 2 * notCloser),
                                          notCloser + rand .Next (nSeed) % (ClientSize .Height - 2 * notCloser));
                 }
                 break;
         }
         loop = new InfinitiveLoop (pts, loop .Radius, loop .HalfStrip, loop .StartColor, loop .EndColor);
         RenewMover ();
         Invalidate ();
     }
 }