0

在 Form1 中,我在左侧面板上创建 8 个图片框,在右侧面板上创建 4 个。

pbs = new PictureBox[8];
            for (int i = 0; i < pbs.Length; i++)
            {
                pbs[i] = new PictureBox();
                pbs[i].MouseEnter += globalPbsMouseEnterEvent;
                pbs[i].MouseLeave += globalPbsMouseLeaveEvent;
                pbs[i].Tag = "PB" + i.ToString();
                pbs[i].Size = new Size(100, 100);
                pbs[i].Margin = new Padding(0, 0, 0, 60);
                pbs[i].Dock = DockStyle.Top;
                pbs[i].SizeMode = PictureBoxSizeMode.StretchImage;
                Panel p = i < 4 ? panel1 : panel2;
                p.Controls.Add(pbs[i]);
                pbs[i].BringToFront();
            }

如何在每个图片框下添加一个细的进度条?

4

1 回答 1

0

现在才做了。谢谢你们。

解决方案:

for (int i = 0; i < pbs.Length; i++)
            {
                progressbars[i] = new ProgressBar();
                progressbars[i].Size = new Size(100, 10);
                progressbars[i].Margin = new Padding(0, 0, 0, 70);
                progressbars[i].Dock = DockStyle.Top;
                pbs[i] = new PictureBox();
                pbs[i].MouseEnter += globalPbsMouseEnterEvent;
                pbs[i].MouseLeave += globalPbsMouseLeaveEvent;
                pbs[i].Tag = "PB" + i.ToString();
                pbs[i].Size = new Size(100, 100);
                pbs[i].Margin = new Padding(0, 0, 0, 60);
                pbs[i].Dock = DockStyle.Top;
                pbs[i].SizeMode = PictureBoxSizeMode.StretchImage;
                Panel p = i < 4 ? panel1 : panel2;
                p.Controls.Add(pbs[i]);
                p.Controls.Add(progressbars[i]);
                pbs[i].BringToFront();
                progressbars[i].BringToFront();
            }
于 2013-10-27T17:46:10.423 回答