Beispiel #1
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;
        }
Beispiel #2
0
        // -------------------------------------------------
        public Form_NameView_ATP (List<PersonalInfoView_ATP> viewsSrc)
        {
            InitializeComponent ();
            mover = new Mover ();

            views = viewsSrc;

            listUsedNames .Columns [0] .Width = listUsedNames .Width - (SystemInformation .VerticalScrollBarWidth + 4);
            ShowUsedNames ();
            RestoreFromRegistry ();
            ccNewName = new CommentedControl (this, textNewName, 0.5, -12, "New name");

            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 ();
        }
        // -------------------------------------------------        DefaultView
        private void DefaultView ()
        {
            int nH = textName .Height;
            int cxL = 90;
            textName .Bounds = new Rectangle (cxL, 36, 96, nH);
            textSurname .Bounds = new Rectangle (cxL, textName .Bottom + spaces .VerMin, textName .Width, textName .Height);
            int cy = textSurname .Bottom + 2 * (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);

            textProfession .Bounds = new Rectangle (cxL, textDay .Bottom + spaces .Btm_inFrame + spaces .Ver_betweenFrames, 300, nH);
            cy = textName .Top;
            int cxR = 400;
            textHomePhone .Bounds = new Rectangle (cxR, cy, 152, nH);
            textOfficePhone .Bounds = new Rectangle (cxR, textHomePhone .Bottom + spaces .VerMin, 152, nH);
            textMobilePhone .Bounds = new Rectangle (cxR, textOfficePhone .Bottom + spaces .VerMin, 152, nH);

            textStreet .Bounds = new Rectangle (cxL, textProfession .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 .Right_inFrame + spaces .FormSideSpace, 
                                   rcAround .Bottom + spaces .Btm_inFrame + spaces .FormBtmSpace);

            string [] strCC = new string [] {"Name", "Surname",                                     // 0, 1
                                             "Month", "Day", "Year", "Profession",                  // 2, 3, 4, 5
                                             "Home", "Office", "Mobile",                            // 6, 7, 8
                                             "Street", "Town", "Province", "Country", "ZIP code"};  // 9 - 13
            SizeF [] sizefStrCC = Auxi_Geometry .MeasureStrings (this, strCC);

            ccName = new CommentedControl (this, textName, -(sizefStrCC [0] .Width / 2 + 4), 0.5, strCC [0]);
            ccSurname = new CommentedControl (this, textSurname, -(sizefStrCC [1] .Width / 2 + 4), 0.5, strCC [1]);
            ccProfession = new CommentedControl (this, textProfession, -(sizefStrCC [5] .Width / 2 + 4), 0.5, strCC [5]);

            CommentedControl cc_month = new CommentedControl (this, textMonth, 0.5, -sizefStrCC [2] .Height / 2, strCC [2]);
            CommentedControl cc_day = new CommentedControl (this, textDay, 0.5, -sizefStrCC [3] .Height / 2, strCC [3]);
            CommentedControl cc_year = new CommentedControl (this, textYear, 0.5, -sizefStrCC [4] .Height / 2, strCC [4]);
            List<ElementInsideDependentFrame> elemsBirth = new List<ElementInsideDependentFrame> ();
            elemsBirth .Add (new ElementInsideDependentFrame (cc_month));
            elemsBirth .Add (new ElementInsideDependentFrame (cc_day));
            elemsBirth .Add (new ElementInsideDependentFrame (cc_year));
            dfBirth = new DependentFrame (this, elemsBirth, spaces, "Birth", StringAlignment .Near, 4);

            int nWidthMax = Convert .ToInt32 (Math .Max (Math .Max (sizefStrCC [6] .Width, sizefStrCC [7] .Width), sizefStrCC [8] .Width));
            CommentedControl cc_home = new CommentedControl (this, textHomePhone, -(nWidthMax + 4) + sizefStrCC [6] .Width / 2, 0.5, strCC [6]);
            CommentedControl cc_office = new CommentedControl (this, textOfficePhone, -(nWidthMax + 4) + sizefStrCC [7] .Width / 2, 0.5, strCC [7]);
            CommentedControl cc_mobile = new CommentedControl (this, textMobilePhone, -(nWidthMax + 4) + sizefStrCC [8] .Width / 2, 0.5, strCC [8]);
            List<ElementInsideDependentFrame> elemPhones = new List<ElementInsideDependentFrame> ();
            elemPhones .Add (new ElementInsideDependentFrame (cc_home));
            elemPhones .Add (new ElementInsideDependentFrame (cc_office));
            elemPhones .Add (new ElementInsideDependentFrame (cc_mobile));
            dfPhones = new DependentFrame (this, elemPhones, spaces, "Phones", StringAlignment .Near, 4);

            nWidthMax = Convert .ToInt32 (sizefStrCC [9] .Width);
            for (int m = 10; m <= 13; m++)
            {
                nWidthMax = Math .Max (nWidthMax, Convert .ToInt32 (sizefStrCC [m] .Width));
            }
            CommentedControl [] cc_addr = new CommentedControl [5];
            for (int m = 0; m < 5; m++)
            {
                cc_addr [m] = new CommentedControl (this, ctrls [9 + m], -(nWidthMax + 4) + sizefStrCC [9 + m] .Width / 2, 0.5, strCC [9 + m]);
            }
            List<ElementInsideDependentFrame> elemAddress = new List<ElementInsideDependentFrame> ();
            for (int m = 0; m < 5; m++)
            {
                elemAddress .Add (new ElementInsideDependentFrame (cc_addr [m]));
            }
            dfAddress = new DependentFrame (this, elemAddress, spaces, "Address", StringAlignment .Near, 4);

            info .Location = new Point (textProvince .Right + 30, textProvince .Bottom);

        }
        // -------------------------------------------------        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++)
                        {
                            ViewOnDependentFrames view = ViewOnDependentFrames .FromRegistry (this, ctrls, regkey, i .ToString ());
                            if (view != null)
                            {
                                views .Add (view);
                            }
                        }
                        ViewOnDependentFrames viewLast = ViewOnDependentFrames .FromRegistry (this, ctrls, regkey, "ViewOnSave");
                        ClientSize = viewLast .Size;
                        info .Location = viewLast .InfoLocation;
                        ccName = CommentedControl .FromData (this, textName, viewLast .DCC_Name);
                        ccSurname = CommentedControl .FromData (this, textSurname, viewLast .DCC_Surname);
                        ccProfession = CommentedControl .FromData (this, textProfession, viewLast .DCC_Profession);
                        dfBirth = DependentFrame .FromData (this, new Control [] { ctrls [2], ctrls [3], ctrls [4] }, viewLast .DF_Birth);
                        dfPhones = DependentFrame .FromData (this, new Control [] { ctrls [6], ctrls [7], ctrls [8] }, viewLast .DF_Phones);
                        dfAddress = DependentFrame .FromData (this, new Control [] { ctrls [9], ctrls [10], ctrls [11], ctrls [12], ctrls [13] },
                                                              viewLast .DF_Address);
                    }
                    else
                    {
                        return;
                    }
                }
            }
            catch
            {
            }
            finally
            {
                if (regkey != null) regkey .Close ();
            }
        }
 // -------------------------------------------------        SetView
 private void SetView (int iView)
 {
     if (0 <= iView && iView < views .Count)
     {
         ViewOnDependentFrames view = views [iView];
         ClientSize = view .Size;
         ccName = CommentedControl .FromData (this, textName, view .DCC_Name);
         ccSurname = CommentedControl .FromData (this, textSurname, view .DCC_Surname);
         ccProfession = CommentedControl .FromData (this, textProfession, view .DCC_Profession);
         dfBirth = DependentFrame .FromData (this, new Control [] { ctrls [2], ctrls [3], ctrls [4] }, view .DF_Birth);
         dfPhones = DependentFrame .FromData (this, new Control [] { ctrls [6], ctrls [7], ctrls [8] }, view .DF_Phones);
         dfAddress = DependentFrame .FromData (this, new Control [] { ctrls [9], ctrls [10], ctrls [11], ctrls [12], ctrls [13] }, 
                                               view .DF_Address);
         info .Location = view .InfoLocation;
     }
 }
Beispiel #7
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 ();
        }