예제 #1
0
        void FinishedLoad()
        {
            this.label1.Text = "Finished";
            for (int i = Content.View.Sections.Count - 1; i >= 0; i--)
            {
                Section d = Content.View.Sections[i];
                pane D = new pane();
                D.Label = d.Name;
                D.Show();
                D.Dock = DockStyle.Left;
                D.Width = 75;
                D.Height = this.panel1.Height;
                D.Sect = new Panel();
                panel1.Controls.Add(D);
                D.panel1 = this.panel1;
                this.contentPanel.Controls.Add(D.Sect);
                D.Sect.Dock = DockStyle.Fill;
                D.S ect.Show();

                if (i == 0)
                {
                    D.Sect.Visible = true;
                }
                foreach (Element a in d.Elements)
                {
                    Control Ds = new Control();
                    switch (a.Type)
                    {
                        case "sp:group":
                            spotifyPanel sp = new spotifyPanel();
                            sp.Label = a.GetAttribute("label");
                            sp.Width = int.Parse(a.GetAttribute("width"));
                            sp.Height = int.Parse(a.GetAttribute("height"));
                            sp.Left = int.Parse(a.GetAttribute("x"));
                            sp.Top = int.Parse(a.GetAttribute("y"));
                            D.Sect.Controls.Add(sp);
                            sp.Show();
                            Ds = sp;
                            break;
                        case "sp:label":
                            Label spx = new Label();
                            if (a.GetAttribute("autoSize") != "")
                            {
                                spx.AutoSize = bool.Parse(a.GetAttribute("autoSize"));

                            }

                            spx.Text = a.GetAttribute("label");
                            spx.Width = int.Parse(a.GetAttribute("width"));
                            spx.Height = int.Parse(a.GetAttribute("height"));
                            spx.Left = int.Parse(a.GetAttribute("x"));
                            spx.Top = int.Parse(a.GetAttribute("y"));

                            spx.ForeColor = Color.Gray;
                            spx.BackColor = Color.Transparent;

                            D.Sect.Controls.Add(spx);
                            spx.Show();
                            Ds = spx;
                            break;

                        default:
                            break;
                    }
                    top += Ds.Height;

                }

                if (i == 0)
                {
                    D.label1_MouseDown((object)D, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                }
                foreach (Control spx in D.Sect.Controls)
                {
                    if (spx.GetType() == typeof(Label))
                        foreach (Control Cont in D.Sect.Controls)
                        {
                            if (Cont.GetType() == typeof(spotifyPanel))
                            {

                                spotifyPanel SD = (spotifyPanel)Cont;
                                if (spx.Left > SD.Left && spx.Top > SD.Top && spx.Left < SD.Width + SD.Left && spx.Top < SD.Height + SD.Top)

                                    spx.ForeColor = Color.Black;
                                spx.BackColor = Color.FromArgb(104, 104, 104);

                            }
                        }
                }
            }
        }