Exemple #1
0
        private void RenderChildXPanel(XPanel ParentXPanel, int ParentPanelX, int ParentPanelY)
        {
            var ChildXPanels = ListOfXPanel.Where(item => item.ParentPanelId == ParentXPanel.Id);

            foreach (var item in ChildXPanels)
            {
                RenderXPanel(item, ParentPanelX, ParentPanelY);
            }
        }
Exemple #2
0
        private void RenderXPanel(XPanel XPanel, int ParentPanelX, int ParentPanelY)
        {
            RenderedXpanel RXPanel = new RenderedXpanel()
            {
                XRecatngle = GetRectangleOfRenderedXPanel(XPanel, ParentPanelX, ParentPanelY)
            };

            RXPanel.Text   = XPanel.Name;
            RXPanel.XColor = Color.Black;
            ListOfRenderedXPanel.Add(RXPanel);
            RenderChildXPanel(XPanel, RXPanel.XRecatngle.X, RXPanel.XRecatngle.Y);
        }
Exemple #3
0
        private void RenderXPanel(XPanel XPanel)
        {
            ListOfRenderedXPanel = new List <RenderedXpanel>();
            RenderedXpanel RXPanel = new RenderedXpanel();

            RXPanel.XRecatngle = GetRectangleOfRenderedXPanel(XPanel);
            RXPanel.Text       = "Root panel";
            RXPanel.XColor     = Color.Black;
            //render XPanel
            ListOfRenderedXPanel.Add(RXPanel);
            RenderChildXPanel(XPanel, RXPanel.XRecatngle.X, RXPanel.XRecatngle.Y);
        }
Exemple #4
0
        private Rectangle GetRectangleOfRenderedXPanel(XPanel XPanel)
        {
            Rectangle rec = new Rectangle()
            {
                Height = (int)XPanel.Heigth,
                Width  = (int)XPanel.Width,
                X      = (int)RootX,
                Y      = (int)RootY
            };

            return(rec);
        }
Exemple #5
0
        private Rectangle GetRectangleOfRenderedXPanel(XPanel XPanel, int ParentPanelX, int ParentPanelY)
        {
            Rectangle rec = new Rectangle();

            switch (XPanel.Orientation)
            {
            case 1:
            case 3:
                rec.Width  = (int)XPanel.Heigth;
                rec.Height = (int)XPanel.Width;
                break;

            default:
                rec.Height = (int)XPanel.Heigth;
                rec.Width  = (int)XPanel.Width;
                break;
            }

            switch (XPanel.Orientation)
            {
            case 1:
                if (XPanel.ParentPanel.Orientation == 0 || XPanel.ParentPanel.Orientation == 2)
                {
                    rec.X = (int)XPanel.ParentPanel.Width + ParentPanelX;
                    rec.Y = ParentPanelY + (int)(XPanel.ParentPanel.Heigth / 2) - rec.Height / 2 + (int)XPanel.HingeOffset;
                }
                else
                {
                    rec.X = (int)XPanel.ParentPanel.Heigth + ParentPanelX;
                    rec.Y = ParentPanelY + (int)(XPanel.ParentPanel.Width / 2) - rec.Height / 2 + (int)XPanel.HingeOffset;
                }
                break;

            case 2:
                if (XPanel.ParentPanel.Orientation == 0 || XPanel.ParentPanel.Orientation == 2)
                {
                    rec.Y = ParentPanelY + (int)XPanel.ParentPanel.Heigth;
                    rec.X = ParentPanelX + (int)(XPanel.ParentPanel.Width / 2) - (int)(XPanel.Width / 2) + (int)XPanel.HingeOffset;
                }
                else
                {
                    rec.Y = ParentPanelY + (int)XPanel.ParentPanel.Width;
                    rec.X = ParentPanelX + (int)(XPanel.ParentPanel.Heigth / 2) - (int)(XPanel.Width / 2) - (int)XPanel.HingeOffset;
                }
                break;

            case 3:
                if (XPanel.ParentPanel.Orientation == 0 || XPanel.ParentPanel.Orientation == 2)
                {
                    rec.Y = ParentPanelY + (int)(XPanel.ParentPanel.Heigth / 2) - rec.Height / 2 - (int)XPanel.HingeOffset;
                    rec.X = ParentPanelX - (int)XPanel.Width;
                }
                else
                {
                    rec.Y = ParentPanelY + (int)(XPanel.ParentPanel.Width / 2) - rec.Height / 2 - (int)XPanel.HingeOffset;
                    rec.X = ParentPanelX - (int)XPanel.Heigth;
                }
                break;

            case 0:
                rec.Y = ParentPanelY - (int)XPanel.Heigth;
                if (XPanel.ParentPanel.Orientation == 0 || XPanel.ParentPanel.Orientation == 2)
                {
                    rec.X = ParentPanelX + (int)(XPanel.ParentPanel.Width / 2) - (int)(XPanel.Width / 2) + (int)XPanel.HingeOffset;
                }
                else
                {
                    rec.X = ParentPanelX + (int)(XPanel.ParentPanel.Heigth / 2) - (int)(XPanel.Width / 2) + (int)XPanel.HingeOffset;
                }

                break;

            default:
                break;
            }
            return(rec);
        }