Example #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 ();
        }
 // -------------------------------------------------        Prepare_lrsView
 private void Prepare_lrsView ()
 {
     lrsView = new LinkedRectangles (new Control [] { numericUD_Radius, numericUD_HalfStrip });  
     lrsView .Add (new Rectangle (numericUD_Radius .Right, numericUD_Radius .Top - nFrame,
                                  Convert .ToInt32 (sizefStrs [0] .Width) + 2 * nFrame, numericUD_Radius .Height + 2 * nFrame));
     lrsView .Add (new Rectangle (numericUD_HalfStrip .Right, numericUD_HalfStrip .Top - nFrame,
                                  Convert .ToInt32 (sizefStrs [1] .Width) + 2 * nFrame, numericUD_HalfStrip .Height + 2 * nFrame));
 }
Example #3
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;
        }
Example #4
0
        // -------------------------------------------------        OnLoad
        private void OnLoad (object sender, EventArgs e)
        {
            rand = Auxi_Common .RandomByCurTime (out nSeed);

            barcharts .Clear ();

            RestoreFromRegistry ();
            if (barcharts .Count <= 0)
            {
                DefaultView ();
            }
            // prepare lrsAdd
            int cxL = numericUD_Sets .Left - (nFrame + 2);
            int cxR = btnEndClr .Right + (nFrame + 2);
            int cyT = numericUD_Sets .Top - (nFrame + Convert .ToInt32 (sizefLabels [0] .Height));
            int cyB = btnAddChart .Bottom + (nFrame + 2);
            Rectangle rc = new Rectangle (cxL, cyT, cxR - cxL, cyB - cyT);
            lrsAdd = new LinkedRectangles (new Control [] { numericUD_Sets, numericUD_Segments, btnStartClr, btnEndClr, btnAddChart });
            lrsAdd .Add (rc);
            lrsAdd .DrawMethod = LCS_Draw;

            RenewMover ();
        }
Example #5
0
 // -------------------------------------------------        Prepare_lrsView
 private void Prepare_lrsView ()
 {
     int cxL = numericUD_Points .Left - (nFrame + 2);
     int cxR = btnEndClr .Right + (nFrame + 2);
     int cyT = numericUD_Points .Top - (nFrame + hStr);
     int cyB = comboView .Bottom + (nFrame + 2);
     Rectangle rc = new Rectangle (cxL, cyT, cxR - cxL, cyB - cyT);
     lrsView = new LinkedRectangles (new Control [] {numericUD_Points, numericUD_Radius, numericUD_HalfStrip, 
                                                     btnStartClr, btnEndClr, comboView });
     lrsView .Add (rc);
     lrsView .DrawMethod = DrawGroup;
 }
Example #6
0
        // -------------------------------------------------
        public Form_PanelsAndGroups ()
        {
            InitializeComponent ();
            //Font = new Font ("Times New Roman", 14);
            mover = new Mover (this);

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

            sizefTitleFramed = Auxi_Geometry .MeasureString (this, strTitle_Framed);
            sizeTitleUnframed = Size .Round (Auxi_Geometry .MeasureString (this, strTitle_Unframed));
            spaces = new Spaces (Convert .ToInt32 (Auxi_Geometry .MeasureString (this, strTitle_Framed) .Height));
            
            lrNoFrame = new LinkedRectangles (new Control [] { btnInsideClr, btnBorderClr, comboShape });
            lrNoFrame .Add (new Rectangle (btnInsideClr .Left, btnInsideClr .Top, btnBorderClr .Right - btnInsideClr .Left,
                                           comboShape .Top - btnInsideClr .Top - 3), "Picture");
            lrNoFrame .Add (new Rectangle (btnInsideClr .Left - 20, btnInsideClr .Top - sizeTitleUnframed .Height, 
                                           sizeTitleUnframed .Width, sizeTitleUnframed .Height), "Title");
            comboShape .SelectedIndex = (int) shape;

            Control [] cntrls = new Control [] { textBox3, listView4, button7, button8, textBox7, textBox6 };
            lrFramed = new LinkedRectangles (cntrls);
            Rectangle rcFrame = Auxi_Geometry .FrameAroundControls (cntrls, spaces);
            rcFrame .Inflate (3, 3);
            lrFramed .Add (rcFrame, "Area");

            rcFrame = Auxi_Geometry .FrameAroundControls (new Control [] { listView5, button9, button10 }, spaces);
            groupNonresizable = new GroupBoxMR (this, rcFrame, strTitleNR, MoveNonresizable);

            int minW = spaces .Left_inFrame + btnCommentClr .Width + btnCommentFont .Width + 2 * spaces .HorMin + 
                       btnAdd .Width + spaces .Right_inFrame;
            int minH = spaces .Top_inFrame + btnAdd .Height * 2 + spaces .VerMin + spaces .Btm_inFrame;
            rcFrame = Auxi_Geometry .FrameAroundControls (new Control [] { textNewComment, btnCommentClr, btnCommentFont, btnAdd }, spaces);
            groupNewCmnt = new GroupBoxMR (this, rcFrame, new RectRange (minW, 3 * minW, minH, 4 * minH), "Resizable GroupBoxMR", MoveResizable);
            ChatPolyRelativePosition ();
            rcFrame = Auxi_Geometry .FrameAroundControls (new Control [] {numericUD_ChatApexes, btnStartPolyClr, btnEndPolyClr, 
                                                                  btnChatPolyCenterClr, panelChatPolyCenterSample, btnAddChatPoly }, spaces);
            groupChatPoly = new Group (this, rcFrame, strChatPolyText [0], MoveChatPolyGroup);

            btnCommentFont_2 .Location = new Point (btnCommentClr_2 .Right, btnCommentClr_2 .Top);
            btnAdd_2 .Location = new Point (btnCommentFont_2 .Right + spaces .HorMin, btnCommentClr_2 .Top);
            int minH_textNewComment = 60;
            textNewComment_2 .Bounds = new Rectangle (btnCommentClr_2 .Left, btnCommentClr_2 .Top - (spaces .VerMin + minH_textNewComment),
                                                      btnAdd_2 .Right - btnCommentClr_2 .Left, minH_textNewComment);
            rcFrame = Auxi_Geometry .FrameAroundControls (new Control [] { textNewComment_2, btnCommentClr_2, btnCommentFont_2, btnAdd_2 }, spaces);
            groupNewCmnt_2 = new Group (this, rcFrame, 
                                        new RectRange (rcFrame .Width, 4 * rcFrame .Width, rcFrame .Height, 3 * rcFrame .Height),
                                        "Resizable Group", MoveNewGroup);

            List<ElementInsideDependentFrame> elemsDF = new List<ElementInsideDependentFrame> ();
            elemsDF .Add (new ElementInsideDependentFrame (textBox8));
            elemsDF .Add (new ElementInsideDependentFrame (button13));
            elemsDF .Add (new ElementInsideDependentFrame (button12));
            elemsDF .Add (new ElementInsideDependentFrame (button11));
            dfSimilar = new DependentFrame (this, elemsDF, spaces, "DependentFrame"); 

            string [] strs = new string [] { "Street", "Town", "Province", "Country", "ZIP code" };
            SizeF [] sizefStrs = Auxi_Geometry .MeasureStrings (this, strs);
            double fWidthMax = Auxi_Geometry .LongestString (this, strs);
            ccStreet = new CommentedControl (this, textStreet, -(fWidthMax + 4) + sizefStrs [0] .Width / 2, 0.5, strs [0]);
            ccTown = new CommentedControl (this, textTown, -(fWidthMax + 4) + sizefStrs [1] .Width / 2, 0.5, strs [1]);
            ccProvince = new CommentedControl (this, textProvince, -(fWidthMax + 4) + sizefStrs [2] .Width / 2, 0.5, strs [2]);
            ccCountry = new CommentedControl (this, textCountry, -(fWidthMax + 4) + sizefStrs [3] .Width / 2, 0.5, strs [3]);
            ccZipCode = new CommentedControl (this, textZipCode, -(fWidthMax + 4) + sizefStrs [4] .Width / 2, 0.5, strs [4]);
            List<ElementInsideDependentFrame> elemsAddress = new List<ElementInsideDependentFrame> ();
            elemsAddress .Add (new ElementInsideDependentFrame (ccStreet));
            elemsAddress .Add (new ElementInsideDependentFrame (ccTown));
            elemsAddress .Add (new ElementInsideDependentFrame (ccProvince));
            elemsAddress .Add (new ElementInsideDependentFrame (ccCountry));
            elemsAddress .Add (new ElementInsideDependentFrame (ccZipCode));
            dfAddress = new DependentFrame (this, elemsAddress, spaces, "DependentFrame", StringAlignment .Far, 4);

            CreateInfo (spaces .FormSideSpace, panelResizable .Bottom + spaces .Ver_betweenFrames);

            RenewMover ();
        }