Beispiel #1
0
        private void Form3_Load(object sender, EventArgs e)
        {
            Color[] colors = new Color[] {
                Color.FromArgb(23, 149, 75),
                Color.FromArgb(1, 187, 225),
                Color.FromArgb(176, 226, 64),
                Color.FromArgb(160, 0, 168),
                Color.FromArgb(190, 30, 74),
                Color.FromArgb(10, 89, 196),
                Color.FromArgb(218, 84, 46),
            };

            Random r = new Random();

            MetroList.Width  = this.Width - 100;
            MetroList.Height = this.Height - 100;

            for (int i = 0; i < 1000; i++)
            {
                DuiLabel lbl = new DuiLabel();
                lbl.Size        = new System.Drawing.Size(190, 140);
                lbl.Text        = (i + 1).ToString();
                lbl.Location    = new Point(5, 0);
                lbl.BackColor   = colors[r.Next(0, colors.Length)];
                lbl.ForeColor   = Color.White;
                lbl.TextAlign   = ContentAlignment.MiddleCenter;
                lbl.MouseEnter += lbl_MouseEnter;
                lbl.MouseLeave += lbl_MouseLeave;

                DuiBaseControl item = new DuiBaseControl();
                //item.BackColor = Color.FromArgb(14, 109, 56);
                item.Size = new System.Drawing.Size(200, 150);
                item.Controls.Add(lbl);
                MetroList.Items.Add(item);
            }
            MetroList.RefreshList();
        }
Beispiel #2
0
        private void ListBox_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < 10000; i++)
            {//往LayeredListBox里面添加项目
                if (i % 100 != 0)
                {
                    DuiLabel lbl = new DuiLabel();
                    lbl.Size     = new System.Drawing.Size(40, 20);
                    lbl.Text     = (i + 1).ToString();
                    lbl.Location = new Point(60, 8);

                    DuiLabel info = new DuiLabel();
                    info.Size      = new System.Drawing.Size(70, 20);
                    info.Text      = "信息。。。";
                    info.Location  = new Point(59, 30);
                    info.ForeColor = Color.FromArgb(60, 60, 60);

                    DuiBaseControl pic = new DuiBaseControl();
                    pic.Size                  = new System.Drawing.Size(45, 45);
                    pic.Location              = new Point(5, 5);
                    pic.BackColor             = Color.BurlyWood;
                    pic.BackgroundImage       = qq;
                    pic.BackgroundImageLayout = ImageLayout.Stretch;

                    DuiBaseControl item = new DuiBaseControl();
                    item.BackColor   = Color.FromArgb(100, Color.White);
                    item.Width       = layeredListBox1.Width;
                    item.Height      = 55;
                    item.MouseEnter += dui_MouseEnter;
                    item.MouseLeave += dui_MouseLeave;
                    item.Controls.Add(lbl);
                    item.Controls.Add(info);
                    item.Controls.Add(pic);
                    item.Name = (i + 1).ToString();
                    layeredListBox1.Items.Add(item);
                }
                else
                {
                    DuiLabel dui = new DuiLabel();
                    dui.Text      = "    收起或打开";
                    dui.TextAlign = ContentAlignment.MiddleLeft;
                    //dui.TextRenderMode=System.Drawing.Text.TextRenderingHint.AntiAlias;
                    dui.BackgroundImageLayout = ImageLayout.None;
                    dui.BackColor             = Color.FromArgb(150, Color.White);
                    dui.BackgroundImage       = open;
                    dui.Width       = layeredListBox1.Width;
                    dui.Height      = 25;
                    dui.Name        = i.ToString();
                    dui.Tag         = "open";
                    dui.MouseClick += dui_MouseClick;
                    dui.MouseEnter += title_MouseEnter;
                    dui.MouseLeave += title_MouseLeave;
                    layeredListBox1.Items.Add(dui);
                }
            }

            layeredListBox1.RefreshList();

            for (int i = 0; i < 99; i++)
            {
                DuiLabel lbl = new DuiLabel();
                lbl.Size        = new System.Drawing.Size(90, 90);
                lbl.Text        = (i + 1).ToString();
                lbl.Location    = new Point(5, 5);
                lbl.BackColor   = Color.FromArgb(23, 149, 75);
                lbl.ForeColor   = Color.White;
                lbl.TextAlign   = ContentAlignment.MiddleCenter;
                lbl.MouseEnter += lbl_MouseEnter;
                lbl.MouseLeave += lbl_MouseLeave;

                DuiBaseControl item = new DuiBaseControl();
                item.BackColor = Color.FromArgb(14, 109, 56);
                item.Size      = new System.Drawing.Size(100, 100);
                item.Controls.Add(lbl);
                MetroList.Items.Add(item);
            }
            MetroList.RefreshList();
            layeredListBox2.RefreshList();
            layeredListBox2.InnerDuiControl.BorderRender = new FilletBorderRender(10, 1, Color.Black);
            this.Animation.Effect = new LayeredSkin.Animations.RandomCurtainEffect();//设置启动特效
        }