标题:这段觉得写得有点啰嗦,请帮忙修改修改
取消只看楼主
jack_xu2046
Rank: 2
等 级:论坛游民
帖 子:72
专家分:11
注 册:2008-10-1
结帖率:81.82%
已结贴  问题点数:10 回复次数:3 
这段觉得写得有点啰嗦,请帮忙修改修改
            for (int i = 0; i < 5; i++)
            {
                tmp = ra.Next(minValue, maxValue); //随机取数
                arrNum[i] = getNum(arrNum, tmp, minValue, maxValue, ra); //取出值赋到数组中
               
            }

            MemoryStream ms0 = new MemoryStream(FromDataBase(arrNum[0]));
            MemoryStream ms1 = new MemoryStream(FromDataBase(arrNum[1]));
            MemoryStream ms2 = new MemoryStream(FromDataBase(arrNum[2]));
            MemoryStream ms3 = new MemoryStream(FromDataBase(arrNum[3]));
            MemoryStream ms4 = new MemoryStream(FromDataBase(arrNum[4]));
            pictureBox1.Image = Image.FromStream(ms0, true);
            label1.Text = GetNameFromDateBase(arrNum[0]);
            pictureBox2.Image = Image.FromStream(ms1, true);
            label2.Text = GetNameFromDateBase(arrNum[1]);
            pictureBox3.Image = Image.FromStream(ms2, true);
            label3.Text = GetNameFromDateBase(arrNum[2]);
            pictureBox4.Image = Image.FromStream(ms3, true);
            label4.Text = GetNameFromDateBase(arrNum[3]);
            pictureBox5.Image = Image.FromStream(ms4, true);
            label5.Text = GetNameFromDateBase(arrNum[4]);
搜索更多相关主题的帖子: 啰嗦 
2010-10-10 12:25
jack_xu2046
Rank: 2
等 级:论坛游民
帖 子:72
专家分:11
注 册:2008-10-1
得分:0 
回复 楼主 jack_xu2046
            for (int i = 0; i < 5; i++)
            {
                tmp = ra.Next(minValue, maxValue); //随机取数
                arrNum[i] = getNum(arrNum, tmp, minValue, maxValue, ra); //取出值赋到数组中
                ms[i] = new MemoryStream(FromDataBase(arrNum[i]));
            }
            pictureBox1.Image = Image.FromStream(ms[0], true);
            label1.Text = GetNameFromDateBase(arrNum[0]);
            pictureBox2.Image = Image.FromStream(ms[1], true);
            label2.Text = GetNameFromDateBase(arrNum[1]);
            pictureBox3.Image = Image.FromStream(ms[2], true);
            label3.Text = GetNameFromDateBase(arrNum[2]);
            pictureBox4.Image = Image.FromStream(ms[3], true);
            label4.Text = GetNameFromDateBase(arrNum[3]);
            pictureBox5.Image = Image.FromStream(ms[4], true);
            label5.Text = GetNameFromDateBase(arrNum[4]);
        }
修改了一下,如何将picturebox与label放到循环中?

菜鸟中的菜鸟
2010-10-10 12:52
jack_xu2046
Rank: 2
等 级:论坛游民
帖 子:72
专家分:11
注 册:2008-10-1
得分:0 
回复 4楼 wangnannan
这方法不错

菜鸟中的菜鸟
2010-10-11 17:42
jack_xu2046
Rank: 2
等 级:论坛游民
帖 子:72
专家分:11
注 册:2008-10-1
得分:0 
以下是引用bygg在2010-10-11 12:38:30的发言:

反射.   
具体咋实现,可以演示一下吗

菜鸟中的菜鸟
2010-10-11 17:44



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-322435-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.059175 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved