예제 #1
0
        // -------------------------------------------------
        public Form_PerforatedPolygons ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            clrNew = (BackColor != Color .White) ? Color .White : Color .LightGray;
            panelColor .BackColor = clrNew;

            PerforatedPolygon pp3 = new PerforatedPolygon (3, new PointF (150, 150), 50, 120, Color .LightGreen, 0);
            PerforatedPolygon pp4 = new PerforatedPolygon (4, new Point (400, 150), 50, 100, Color .Cyan, 45);
            PerforatedPolygon pp6 = new PerforatedPolygon (6, new Point (150, 400), 50, 100, Color .Blue, -75);
            PerforatedPolygon pp9 = new PerforatedPolygon (9, new Point (400, 400), 50, 100, Color .Yellow, 0);

            figures .Clear ();
            figures .Insert (0, pp3);
            figures .Insert (0, pp4);
            figures .Insert (0, pp6);
            figures .Insert (0, pp9);

            string info = "To Move   - L_Press inside\n" +
                          "To Rotate - R_Press inside\n" +
                          "To Zoom   - L_Press on border\n" +
                          "To Popup  - L_Click inside";
            text = new TextM (this, new Point (450, 50), info);
 
            string [] strs = new string[] {"Sides", "Color"};
            Size [] sizeStrs = Auxi_Geometry .RoundMeasureStrings (this, strs);
            CommentedControl ccSides = new CommentedControl (this, numericUD_Sides, 4 + sizeStrs [0] .Width / 2, 0.5, strs [0]);
            CommentedControl ccColor = new CommentedControl (this, panelColor, 4 + sizeStrs [1] .Width / 2, 0.5, strs [1]);
            List<ElementInsideDependentFrame> elems = new List<ElementInsideDependentFrame> ();
            elems .Add (new ElementInsideDependentFrame (ccSides));
            elems .Add (new ElementInsideDependentFrame (ccColor));
            elems .Add (new ElementInsideDependentFrame (new FramedControl (btnAdd)));
            df = new DependentFrame (this, elems, 12, "New polygon");  
            RenewMover ();
        }
예제 #2
0
 // -------------------------------------------------        Click_btnAdd
 private void Click_btnAdd (object sender, EventArgs e)
 {
     PerforatedPolygon poly = new PerforatedPolygon ((int) numericUD_Sides .Value, Auxi_Geometry .Middle (this .ClientRectangle),
                                                     50, 150, clrNew, 0);
     figures .Insert (0, poly);
     RenewMover ();
     Invalidate ();
 }