Esempio n. 1
0
        void main__form()
        {
            MetroPanel panel__left        = new MetroPanel();
            MetroTile  panel__left__title = new MetroTile();

            MetroPanel panel__Right        = new MetroPanel();
            MetroTile  panel__Right__title = new MetroTile();

            PictureBox[] picture__news = new PictureBox[8];
            MetroLabel[] body          = new MetroLabel[8];
            MetroLabel[] date          = new MetroLabel[8];
            for (int i = 0; i < 8; i++)
            {
                date[i]          = new MetroLabel();
                picture__news[i] = new PictureBox();
                body[i]          = new MetroLabel();
            }


            // Main

            // Left
            panel__left.Location    = new Point(27, 72);
            panel__left.Size        = new Size(1030, 720);
            panel__left.Name        = "Left";
            panel__left.Theme       = MetroFramework.MetroThemeStyle.Dark;
            panel__left.BorderStyle = MetroFramework.Drawing.MetroBorderStyle.FixedSingle;

            //Left label
            panel__left__title.Location = new Point(3, 3);
            panel__left__title.Size     = new Size(148, 53);
            panel__left__title.Name     = "Left__title";
            panel__left__title.Text     = "Главное";
            panel__left__title.Style    = MetroFramework.MetroColorStyle.Red;

            //Right
            panel__Right.Location    = new Point(1082, 72);
            panel__Right.Size        = new Size(472, 720);
            panel__Right.Name        = "Right";
            panel__Right.Theme       = MetroFramework.MetroThemeStyle.Dark;
            panel__Right.BorderStyle = MetroFramework.Drawing.MetroBorderStyle.FixedSingle;

            //Right__title

            panel__Right__title.Location = new Point(3, 3);
            panel__Right__title.Size     = new Size(151, 53);
            panel__Right__title.Name     = "Right__title";
            panel__Right__title.Text     = "Новости";
            panel__Right__title.Style    = MetroFramework.MetroColorStyle.Red;



            //Left Panel
            this.metroPanel2.Controls.Add(panel__left);
            panel__left.Controls.Add(panel__left__title);

            //Right Panel
            metroPanel2.Controls.Add(panel__Right);
            panel__Right.Controls.Add(panel__Right__title);


            connect con = new connect();

            string[] news  = con.news().Split('=');
            int      width = 100;
            int      j     = 0;

            for (int i = news.Length - 2; i >= 0; i--)
            {
                if (j > -8)
                {
                    //header
                    date[Math.Abs(j)].Location = new Point(26, width);
                    date[Math.Abs(j)].Size     = new Size(76, 64);
                    date[Math.Abs(j)].Name     = "Body__News " + i;
                    date[Math.Abs(j)].Text     = news[i].Split('%')[0];
                    date[Math.Abs(j)].Theme    = MetroFramework.MetroThemeStyle.Light;

                    //body
                    body[Math.Abs(j)].Location = new Point(106, width);
                    body[Math.Abs(j)].Size     = new Size(247, 64);
                    body[Math.Abs(j)].Name     = "Body__News " + i;
                    body[Math.Abs(j)].Text     = news[i].Split('%')[1];
                    body[Math.Abs(j)].Theme    = MetroFramework.MetroThemeStyle.Light;
                    //picturebox
                    picture__news[Math.Abs(j)].Location = new Point(359, width);
                    picture__news[Math.Abs(j)].Size     = new Size(100, 64);
                    picture__news[Math.Abs(j)].Name     = "Body__News " + i;
                    picture__news[Math.Abs(j)].Image    = Image.FromFile(news[i].Split('%')[2]);
                    picture__news[Math.Abs(j)].SizeMode = PictureBoxSizeMode.Zoom;

                    panel__Right.Controls.Add(date[Math.Abs(j)]);
                    panel__Right.Controls.Add(body[Math.Abs(j)]);
                    panel__Right.Controls.Add(picture__news[Math.Abs(j)]);

                    width += 78;
                    j--;
                }
                else
                {
                    break;
                }
            }
        }