Exemple #1
0
        // -------------------------------------------------
        public Form_BoardsAndBalls ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("Times New Roman", 14);

            clrFrameLR = Auxi_Colours .IntermediateClr (0.7, BackColor, ControlPaint .Dark (BackColor));
            penFrameLR = new Pen (clrFrameLR);

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

            lrNew = new LinkedRectangles (new Control [] { numericUD_Balls, checkSameSize, buttonAdd });
            int cxL = numericUD_Balls .Left - spaces .Left_inFrame;
            int cyT = numericUD_Balls .Top - spaces .Top_inFrame;
            int cxR = buttonAdd .Right + spaces .Right_inFrame;
            int cyB = buttonAdd .Bottom + spaces .Btm_inFrame;
            Rectangle rcArea = new Rectangle (cxL, cyT, cxR - cxL, cyB - cyT);
            rcArea .Inflate (3, 3);
            lrNew .Add (rcArea, "Area");

            rand = Auxi_Common .RandomByCurTime (out nSeed);

            boards .Add (new BoardWithBalls (this, new Rectangle (40, 70, 400, 300), Color .White, 5, false, 
                                             new Font ("Times New Roman", 14, FontStyle .Bold | FontStyle .Italic), Color .Blue));
            info = new TextM (this, new Point (200, 400), cmnts);
            info .ShowBackground = false;

            comboCase .SelectedIndex = 0;
            RenewMover ();
        }
Exemple #2
0
        // -------------------------------------------------
        public Form_LinkedElements ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            //Font = new Font ("Times New Roman", 14);

            rand = Auxi_Common .RandomByCurTime (out nSeed);
            spaces = new Spaces (Convert .ToInt32 (Auxi_Geometry .MeasureString (this, strChatPolyText [0]) .Height));

            // dfRegPoly
            string [] strs = new string [] { "Sides", "Color" };
            Size [] sizeStrs = Auxi_Geometry .RoundMeasureStrings (this, strs);
            CommentedControl ccSides = new CommentedControl (this, numericUD_RegSides, 4 + sizeStrs [0] .Width / 2, 0.5, strs [0]);
            CommentedControl ccColor = new CommentedControl (this, panelRegPolyClr, 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 (btnAddRegPoly)));
            dfRegPoly = new DependentFrame (this, elems, spaces, "Regular polygon");  

            // lrsCircle
            lrsCircle = new LinkedRectangles (new Control [] { btnCircleClr, panelCircleSample, btnAddCircle });
            sizeStrs = Auxi_Geometry .RoundMeasureStrings (this, strCircle);
            lrsCircle .Add (new Rectangle (btnCircleClr .Left, btnCircleClr .Top - (sizeStrs [0] .Height + 4),
                                           sizeStrs [0] .Width, sizeStrs [0] .Height), "Title");
            int cyT = (panelCircleSample .Top + panelCircleSample .Bottom) / 2 - sizeStrs [1] .Height / 2;
            lrsCircle .Add (new Rectangle (panelCircleSample .Right + 4, cyT, sizeStrs [1] .Width, sizeStrs [1] .Height), "ColorLabel");
            lrsCircle .Add (new Rectangle (panelCircleSample .Right, cyT, btnAddCircle .Right - panelCircleSample .Right, btnAddCircle .Top - cyT));

            InGroupRelativePosition ();
            Rectangle rc = Auxi_Geometry .FrameAroundControls (new Control [] {numericUD_ChatApexes, btnStartPolyClr, btnEndPolyClr, 
                                                                     btnChatPolyCenterClr, panelChatPolyCenterSample, btnAddChatPoly }, spaces);
            groupChatPoly = new Group (this, rc, strChatPolyText [0], MoveChatPolyGroup);

            mover .Insert (0, buttonCovers);
            dfRegPoly .IntoMover (mover, 0);
            mover .Insert (0, lrsCircle);
            mover .Insert (0, groupChatPoly);

            info = new TextM (this, new Point (210, 170),
                              "Different classes are used to add the new colored figures:\n" +
                              "   regular polygons are added via the DependentFrame class,\n" +
                              "   circles are added via the LinkedRectangles class,\n" +
                              "   chatoyant polygons are added via the Group class.\n" +
                              "All colored figures can be moved (L_Press inside) and\n" +
                              "resized (L_Press on border); chatoyant polygons can be also\n" +
                              "rotated (R_Press) and reconfigured (L_Press on apexes).\n" +
                              "L_Click any colored figure to popup it.", 
                              new Font ("Microsoft Sans Serif", 9));
            info .BackColor = Color .Yellow;
            mover .Add (info);

            iTopElemOrder = mover .Count;

            panelRegPolyClr .BackColor = clrNewRegPoly;
            panelCircleSample .BackColor = clrNewCircle;
            panelChatPolyCenterSample .BackColor = clrChatPolyCenter;
        }
        // -------------------------------------------------
        public Form_CombiRegularPolygons ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            text = new TextM (this, new Point (300, 80), cmnts);
            rand = Auxi_Common .RandomByCurTime (out nSeed);
            NewSet ();
            RenewMover ();
        }
        // -------------------------------------------------
        public Form_CircleInRotation ()
        {
            InitializeComponent ();
            mover = new Mover (this);

            circle = new NRCircle (Auxi_Geometry .LocationByCoefficients (ClientRectangle, 0.4, 0.4), ClientRectangle .Height / 3,
                                   new double [] { 3, 17, 8, 5, 12, 9, 2, 7, 11, 9 });
            mover .Add (circle);
            mover .Insert (0, btnCovers);

            info = new TextM (this, new Point (300, 360),
                              "Move by any inner point (L_Press)\nResize by any border point (L_Press)\nRotate by any inner point (R_Press)");
            mover .Add (info);
        }
        // -------------------------------------------------        OnLoad
        private void OnLoad (object sender, EventArgs e)
        {
            numericUD_Apexes .Value = 7;
            nRadius = Math .Min (ClientSize .Width, ClientSize .Height) / 3;
            ptCenter = new Point (ClientSize .Width * 7 / 12, ClientSize .Height / 2);

            sampleCenter = new SquareSample (new Point (ClientRectangle .Width - 18, 18), halfSq, clrCenter);
            CreatePolygon ();
            CreateApexSamples ();

            ccApexes = new CommentedControlLTP (this, numericUD_Apexes, Side .W, "Apexes");

            penString = new Pen (ControlPaint .Dark (BackColor));
            text = new TextM (this, new Point (ClientSize .Width / 6, ClientSize .Height * 7 / 10), info, Color .Blue);
            text .ShowBackground = false;

            RenewMover ();
            bAfterInit = true;
        }
Exemple #6
0
        // -------------------------------------------------        OnLoad
        private void OnLoad (object sender, EventArgs e)
        {
            Auxi_Colours .VisibleFrame (this);

            plot = new MSPlot (this, new Rectangle (50, 60, 350, 290), Side .S, 0.0, 4 * Math .PI, GridOrigin .ByStep, Math .PI,
                                                                       Side .E, 1.0, -1.0, GridOrigin .ByStep, 0.5);
            plot .AddComment (0.5, -14, "Sin (x) * Cos (12x)", 
                              new Font ("Times New Roman", 11, FontStyle .Bold | FontStyle .Italic), 0, Color .Blue);

            piechart = new PieChart (this, new Point (500, 330), 140, Auxi_Common .RandomArray (1000, Auxi_Common .strDays .Length));
            piechart .SectorTexts = Auxi_Common .strDays;

            Font fnt = new Font ("Times New Roman", 14, FontStyle.Bold | FontStyle.Italic);
            house9 = new ApartmentHouse (new Rectangle (690, 110, 120, 210));
            house9 .HouseColor = Color .White;
            house9 .RoofColor = Color .Red;
            house9 .DoorColor = Color .Brown;
            house9 .WindowColor = Color .Cyan;

            house23 = new ApartmentHouse (new Rectangle (580, 90, 130, 110));
            house23 .HouseColor = Color .Yellow;
            house23 .RoofColor = Color .Green;

            Point ptC = new Point (100, 440);
            int radius = 50;
            Color [] clrs = Auxi_Colours .SmoothChangedColors (4, Auxi_Colours .ColorPredefined (4), Auxi_Colours .ColorPredefined (5));
            poly4 = new ChatoyantPolygon (Auxi_Geometry .RegularPolygon (4, ptC, radius, 0), ptC, clrs, Auxi_Colours .ColorPredefined (6));
            ptC = new Point (260, 460);
            radius = 75;
            clrs = Auxi_Colours .SmoothChangedColors (7, Auxi_Colours .ColorPredefined (7), Auxi_Colours .ColorPredefined (8));
            poly7 = new ChatoyantPolygon (Auxi_Geometry .RegularPolygon (7, ptC, radius, 0), ptC, clrs, Auxi_Colours .ColorPredefined (9));

            info = new TextM (this, new Point (plot .MainArea .Area .Right + 30, Convert .ToInt32 (poly4 .Center .Y) + 20), strInfo);
            info .BackColor = Color .FromArgb (255, 255, 128);

            ClientSize = new Size (Math .Max (info .Area .Right, house9 .Area .Right) + 20, info .Area .Bottom + 12);

            timerStart .Enabled = true;
            timerStart .Start ();

            RenewMover ();
        }
        // -------------------------------------------------
        public Form_PersonalInfo_LTP ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            mover .Clipping = Clipping .Safe;

            ctrls = new Control [] {textName, textSurname,                                          // 0, 1
                                    textMonth, textDay, textYear,                                   // 2, 3, 4
                                    textProfession,                                                 // 5
                                    textHomePhone, textOfficePhone, textMobilePhone,                // 6, 7, 8
                                    textStreet, textTown, textProvince, textCountry, textZipCode};  // 9 - 13
            comctrls = new CommentedControlLTP [ctrls .Length];

            spaces = new Spaces (Auxi_Geometry .RoundMeasureString (this, "Temporary") .Height);
            tmBirth = new TextM (this, new Point (100, 100), "Birth");
            tmBirth .ShowFrame = false;
            DefaultView ();
            RestoreFromRegistry ();

            RenewMover ();
        }
        // -------------------------------------------------
        public Form_PersonalInfo_DependentFrame ()
        {
            InitializeComponent ();
            mover = new Mover (this);
            mover .Clipping = Clipping .Safe;

            spaces = new Spaces (Auxi_Geometry .RoundMeasureString (this, "Any text") .Height);
            info = new TextM (this, new Point (textProvince .Right + 30, textProvince .Bottom), strInfo);
            info .BackColor = Color .FromArgb (255, 255, 128);

            ctrls = new Control [] {textName, textSurname,                                          // 0, 1
                                    textMonth, textDay, textYear,                                   // 2, 3, 4
                                    textProfession,                                                 // 5
                                    textHomePhone, textOfficePhone, textMobilePhone,                // 6, 7, 8
                                    textStreet, textTown, textProvince, textCountry, textZipCode};  // 9 - 13
            DefaultView ();
            RestoreFromRegistry ();
            if (views .Count > 0)
            {
                SetView (0);
            }
            RenewMover ();
        }
        // -------------------------------------------------
        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 ();
        }
Exemple #10
0
        // -------------------------------------------------        DefaultView
        private void DefaultView ()
        {
            int nH = textName .Height;
            int cxL = 90;
            textName .Bounds = new Rectangle (cxL, 30, 96, nH);
            textSurname .Bounds = new Rectangle (cxL, textName .Bottom + spaces .VerMin, textName .Width, textName .Height);
            int cy = textSurname .Bottom + spaces .VerMin + nH;
            textMonth .Location = new Point (cxL, cy);
            textDay .Location = new Point (textMonth .Right + spaces .HorMin, cy);
            textYear .Location = new Point (textDay .Right + spaces .HorMin, cy);
            tmBirth .Location = new Point (cxL - (tmBirth .Width + 4), textMonth .Top + textMonth .Height / 2 - tmBirth .Height / 2);

            textProfession .Bounds = new Rectangle (cxL, textDay .Bottom + 2 * spaces .VerMin, 300, nH);
            cy = textProfession .Bottom + spaces .VerMin + nH;
            textHomePhone .Bounds = new Rectangle (cxL, cy, 152, nH);
            textOfficePhone .Bounds = new Rectangle (textHomePhone .Right + spaces .HorMin, cy, 152, nH);
            textMobilePhone .Bounds = new Rectangle (textOfficePhone .Right + spaces .HorMin, cy, 152, nH);

            textStreet .Bounds = new Rectangle (cxL, textHomePhone .Bottom + spaces .VerMin + nH, 152, nH);
            textTown .Bounds = new Rectangle (cxL, textStreet .Bottom + spaces .VerMin, 152, nH);
            textProvince .Bounds = new Rectangle (cxL, textTown .Bottom + spaces .VerMin, 152, nH);
            textCountry .Bounds = new Rectangle (cxL, textProvince .Bottom + spaces .VerMin, 152, nH);
            textZipCode .Bounds = new Rectangle (cxL, textCountry .Bottom + spaces .VerMin, 90, nH);

            Rectangle rcAround = Auxi_Geometry .FrameAroundControls (ctrls, spaces);
            ClientSize = new Size (rcAround .Right + spaces .FormSideSpace, rcAround .Bottom + spaces .FormBtmSpace);

            string [] strCC = new string [] {"Name", "Surname", "Month", "Day", "Year", "Profession", 
                                             "Home phone", "Office phone", "Mobile phone", 
                                             "Street", "Town", "Province", "Country", "ZIP code"};

            comctrls [0] = new CommentedControlLTP (this, ctrls [0], Side .W, StringAlignment .Center, 4, strCC [0]);
            comctrls [1] = new CommentedControlLTP (this, ctrls [1], Side .W, StringAlignment .Center, 4, strCC [1]);
            comctrls [2] = new CommentedControlLTP (this, ctrls [2], Side .N, StringAlignment .Near, strCC [2]);
            comctrls [3] = new CommentedControlLTP (this, ctrls [3], Side .N, StringAlignment .Near, strCC [3]);
            comctrls [4] = new CommentedControlLTP (this, ctrls [4], Side .N, StringAlignment .Near, strCC [4]);
            comctrls [5] = new CommentedControlLTP (this, ctrls [5], Side .W, StringAlignment .Center, strCC [5]);
            comctrls [6] = new CommentedControlLTP (this, ctrls [6], Side .N, StringAlignment .Near, strCC [6]);
            comctrls [7] = new CommentedControlLTP (this, ctrls [7], Side .N, StringAlignment .Near, strCC [7]);
            comctrls [8] = new CommentedControlLTP (this, ctrls [8], Side .N, StringAlignment .Near, strCC [8]);
            comctrls [9] = new CommentedControlLTP (this, ctrls [9], Side .W, StringAlignment .Center, strCC [9]);
            comctrls [10] = new CommentedControlLTP (this, ctrls [10], Side .W, StringAlignment .Center, strCC [10]);
            comctrls [11] = new CommentedControlLTP (this, ctrls [11], Side .W, StringAlignment .Center, strCC [11]);
            comctrls [12] = new CommentedControlLTP (this, ctrls [12], Side .W, StringAlignment .Center, strCC [12]);
            comctrls [13] = new CommentedControlLTP (this, ctrls [13], Side .W, StringAlignment .Center, strCC [13]);

            info = new TextM (this, new Point (textProvince .Right + 30, textProvince .Bottom), strInfo);
            info .BackColor = Color .FromArgb (255, 255, 128);
        }
Exemple #11
0
 // -------------------------------------------------
 public PersonalInfoView_LTP (string nm, Size sizeClient, Point ptinf, TextM tm, CommentedControlLTP_Data [] comds)
 {
     name = nm;
     size = sizeClient;
     ptInfo = ptinf;
     txm = tm;
     dccs = comds;
 }
Exemple #12
0
 // -------------------------------------------------
 public PersonalInfoView_LTP (string nm, Size sizeClient, Point ptinf, TextM tm, CommentedControlLTP [] coms)
 {
     name = nm;
     size = sizeClient;
     ptInfo = ptinf;
     txm = tm;
     dccs = new CommentedControlLTP_Data [coms .Length];
     for (int i = 0; i < coms .Length; i++)
     {
         dccs [i] = new CommentedControlLTP_Data (coms [i]);
     }
 }
Exemple #13
0
        // =================================================        RestoreFromRegistry
        private void RestoreFromRegistry ()
        {
            string namekey = Form_Main .strRegKey + strAddRegKey;

            RegistryKey regkey = null;
            try
            {
                regkey = Registry .CurrentUser .OpenSubKey (namekey, true);
                if (regkey != null)
                {
                    string [] strSizes = (string []) regkey .GetValue (nameSizes);
                    if (strSizes != null && strSizes .Length == 3)
                    {
                        ClientSize = Auxi_Convert .IntoSize (strSizes, 0);
                        int nViews = Convert .ToInt32 (strSizes [2]);
                        for (int i = 0; i < nViews; i++)
                        {
                            PersonalInfoView_LTP view = PersonalInfoView_LTP .FromRegistry (this, regkey, "View_" + i .ToString ());
                            if (view != null)
                            {
                                views .Add (view);
                            }
                        }
                        PersonalInfoView_LTP viewOnSave = PersonalInfoView_LTP .FromRegistry (this, regkey, "OnSave");
                        if (viewOnSave != null)
                        {
                            ClientSize = viewOnSave .Size;
                            info .Location = viewOnSave .InfoLocation;
                            tmBirth = viewOnSave .OneMovableText;
                            for (int i = 0; i < comctrls .Length; i++)
                            {
                                comctrls [i] = CommentedControlLTP .FromData (this, ctrls [i], viewOnSave .CommentsData [i]);
                            }
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch
            {
            }
            finally
            {
                if (regkey != null) regkey .Close ();
            }
        }