111,120
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 联兴布行ERP
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
ArrayList arraylist = new ArrayList();
Random rx = new Random();
private void button1_Click(object sender, EventArgs e)
{
foreach (Control al in Controls)
{
if (al is Button)
{
int i = rx.Next(0, 2);
((Button)(al)).Image=Image.FromFile(arraylist[i].ToString());
}
}
}
private void Form2_Load(object sender, EventArgs e)
{
arraylist.Add(@"C:\Documents and Settings\All Users\Documents\My Pictures\示例图片\Blue hills.jpg");
arraylist.Add(@"C:\Documents and Settings\All Users\Documents\My Pictures\示例图片\Sunset.jpg");
}
}}